TORONTO KIDS COMPUTER CLUB | PMCA Friday 19:00 Python Homework 21.03.26.
19218
post-template-default,single,single-post,postid-19218,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.8.0,vc_responsive

PMCA Friday 19:00 Python Homework 21.03.26.

29 Mar PMCA Friday 19:00 Python Homework 21.03.26.

Question for Sorting:

Question 1:

You are given an array A of non-negative integers of size m. Your task is to sort the array in non-decreasing order and print out the original indices of the new sorted array.

Example:

A= 4,5,3,7,1

After sorting the new array becomes A= 1,3,4,5,7

The required output should be “4 2 0 1 3”   

Input Specification :
The first line of input consists of the size of the array
The next line consists of the array of size m

Output  Specification :
Output consists of a single line of integers
NOTE: The indexing of the array starts with 0.

Sample Input
5
4 5 3 7 1

Sample Output
4 2 0 1 3

Quetion2:
A matrix of same rows and same columns is given .Sakshi wants to Sort the matrix in such manner that she will start from the first element and traverse the matrix in clockwise manner at the end she should be at the middle position with a largest element .Find the solution of Sakshi’s problem.

Input Specification:
First line will take the dimension of matrix i.e. N x N (only one input N).
Second input the elements of matrix.

Output  Specification :
Sorted Matrix in clockwise manner.

Constraints:
0<N<10

Sample Input
3
2 5 12
22 45 55
1 6 8

Sample Output
1 2 5
45 55 6
22 12 8

No Comments

Sorry, the comment form is closed at this time.