English

NCERT solutions for Computer Science [English] Class 12 chapter 5 - Sorting [Latest edition]

Advertisements

Chapters

NCERT solutions for Computer Science [English] Class 12 chapter 5 - Sorting - Shaalaa.com
Advertisements

Solutions for Chapter 5: Sorting

Below listed, you can find solutions for Chapter 5 of CBSE NCERT for Computer Science [English] Class 12.


Exercise
Exercise [Pages 79 - 80]

NCERT solutions for Computer Science [English] Class 12 5 Sorting Exercise [Pages 79 - 80]

Exercise | Q 1. | Page 79

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.

Exercise | Q 2. | Page 79

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
Exercise | Q 3. | Page 79

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.

Exercise | Q 4. | Page 79

Write a program using user defined functions that accepts a List of numbers as an argument and finds its median. (Hint : Use bubble sort to sort the accepted list. If there are odd number of terms, the median is the center term. If there are even number of terms, add the two middle terms and divide by 2 get median)

Exercise | Q 5. | Page 80

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 90th percentile, 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()

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

The corresponding value in the list is the xth percentile.

Exercise | Q 6. | Page 80

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.

Solutions for 5: Sorting

Exercise
NCERT solutions for Computer Science [English] Class 12 chapter 5 - Sorting - Shaalaa.com

NCERT solutions for Computer Science [English] Class 12 chapter 5 - Sorting

Shaalaa.com has the CBSE Mathematics Computer Science [English] Class 12 CBSE solutions in a manner that help students grasp basic concepts better and faster. The detailed, step-by-step solutions will help you understand the concepts better and clarify any confusion. NCERT solutions for Mathematics Computer Science [English] Class 12 CBSE 5 (Sorting) include all questions with answers and detailed explanations. This will clear students' doubts about questions and improve their application skills while preparing for board exams.

Further, we at Shaalaa.com provide such solutions so students can prepare for written exams. NCERT textbook solutions can be a core help for self-study and provide excellent self-help guidance for students.

Concepts covered in Computer Science [English] Class 12 chapter 5 Sorting are Time Complexity of Algorithms, Bubble Sort, Selection Sort, Insertion Sort, Sorting in Data Structure.

Using NCERT Computer Science [English] Class 12 solutions Sorting exercise by students is an easy way to prepare for the exams, as they involve solutions arranged chapter-wise and also page-wise. The questions involved in NCERT Solutions are essential questions that can be asked in the final exam. Maximum CBSE Computer Science [English] Class 12 students prefer NCERT Textbook Solutions to score more in exams.

Get the free view of Chapter 5, Sorting Computer Science [English] Class 12 additional questions for Mathematics Computer Science [English] Class 12 CBSE, and you can use Shaalaa.com to keep it handy for your exam preparation.

Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×