## Sorting NCERT Class 12 CS Solution || Sorting Class 12 Solution || Sorting Python Class 12 CS Solution || Sorting Computer Science Solution || NCERT Sorting Solution || Sorting in Python Class 12 CS || Sorting in Python Solution

**Note :-** Please Click on Question to get Solution of that Question !!

Q1. Consider a list of 10 elements:

numList =[7, 11, 3, 10, 17, 23, 1, 4, 21, 5].

Display the partially sorted list after three complete passes of Bubble sort.

Q2. Identify the number of swaps required for sorting the following list using selection sort and bubble sort and identify which is the better sorting technique with respect to the number of comparisons.

List 1:

63 42 21 9

Q3. Consider the following lists:

List 1:

2 3 5 7 11

List 2:

11 7 5 3 2

If the lists are sorted using Insertion sort then which of the lists List1 or List 2 will make the minimum number of comparisons? Justify using diagrammatic representation.

Q4. Write a program using user defined functions that accepts a List of numbers as an argument and finds its median.

Q5. All the branches of XYZ School conducted an aptitude test for all the students in the age group 14 - 16. There were a total of n students. The marks of n students are stored in a list. Write a program using a user defined function that accepts a list of marks as an argument and calculates the ‘xth’ percentile (where x is any number between 0 and 100).You are required to perform the following steps to be able to calculate the ‘xth ’ percentile.

Note: Percentile is a measure of relative performance i.e. it is calculated based on a candidate’s performance with respect to others.

For example: If a candidate's score is in the 90thpercentile that means she/he scored better than 90% of people who took the test. Steps to calculate the xth percentile:

I. Order all the values in the data set from smallest to largest using Selection Sort. In general any of the sorting methods can be used.

II. Calculate index by multiplying x percent by the total number of values, n.

For example: to find 90th percentile for 120 students:

0.90*120 = 108

III. Ensure that the index is a whole number by using math.round()

VI. Display the value at the index obtained in Step 3.

The corresponding value in the list is the xth percentile.

Q6. During admission in a course, the names of the students are inserted in ascending order. Thus, performing the sorting operation at the time of inserting elements in a list. Identify the type of sorting technique being used and write a program using a user defined function that is invoked every time a name is input and stores the name in ascending order of names in the list.

## Post a Comment

You can help us by Clicking on ads. ^_^

Please do not send spam comment : )