Sorting
CBSE · Class 12 · Computer Science
NCERT Solutions for Sorting — CBSE Class 12 Computer Science.
Interactive on Super Tutor
Studying Sorting? Get the full interactive chapter.
Quizzes, flashcards, AI doubt-solver and a step-by-step study plan — built for ncert solutions and more.
1,000+ Class 12 students started this chapter today

This is just one of 9+ visuals inside Super Tutor's Sorting chapter
Explore the full set3 worked solutions below. Unlock all 6 free in Super Tutor
EXERCISE
1Consider 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.Show solution
.
- Pass 1: largest element moves to the end.
Result:
- Pass 2: next largest moves to its position.
Result:
- Pass 3: next largest moves to its position.
Result:
So after three complete passes, the partially sorted list is:
.
Not sure why a step works? check your working in Super Tutor
2Identify 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.Show solution
## Selection sort
Selection sort places the smallest element at its correct position in each pass.
- Pass 1: smallest is , swap with → 1 swap
- Pass 2: smallest of remaining is , swap with → 1 swap
- Pass 3: smallest of remaining is , already in place → 0 swap
So, selection sort requires 2 swaps.
Number of comparisons in selection sort for :
## Bubble sort
Bubble sort repeatedly compares adjacent elements and swaps if they are unordered.
For :
- Comparisons in pass 1: 3, swaps: 3
- Comparisons in pass 2: 2, swaps: 2
- Comparisons in pass 3: 1, swaps: 1
So, bubble sort requires 6 swaps.
Number of comparisons in bubble sort for :
## Conclusion
- Selection sort swaps = 2
- Bubble sort swaps = 6
- With respect to the number of comparisons, both make 6 comparisons for 4 elements.
- But considering swaps, selection sort is better because it uses fewer swaps.
Not sure why a step works? check your working in Super Tutor
3Consider the following lists:Show solution
- List 1: is already sorted in ascending order.
- List 2: is in descending order, so every element must be compared and shifted.
Therefore, List 1 will make the minimum number of comparisons.
Diagrammatically:
- List 1: each element is already in correct order, so only direct checks are needed.
- List 2: each new element moves through the whole sorted part, causing many comparisons.
Not sure why a step works? check your working in Super Tutor
3 more solved questions in Sorting
Every remaining exercise is solved step by step in Super Tutor, plus practice quizzes and flashcards for this chapter. Free to start.
Stuck on a step?
Ask Super Tutor AI to explain any solution on this page in a simpler way — free, 24x7.
Ask a Doubt FreeFrequently Asked Questions
What are the important topics in Sorting for CBSE Class 12 Computer Science?
How to score full marks in Sorting — CBSE Class 12 Computer Science?
Where can I get free NCERT Solutions for Sorting Class 12 Computer Science?
Sources & Official References
- NCERT Official — ncert.nic.in
- CBSE Academic — cbseacademic.nic.in
- CBSE Official — cbse.gov.in
- National Education Policy 2020 — education.gov.in
Content is aligned to the official syllabus. Refer to the board website for the latest curriculum.
More resources for Sorting
Practice Quiz
Test yourself with a quick quiz
Important Questions
Practice with board exam-style questions
Revision Notes
Key points for last-minute revision
Formula Sheet
All formulas in one place
Chapter Summary
Understand the chapter at a glance
Concept Maps
See how topics connect visually
Study Plan
Step-by-step plan to ace this chapter
Flashcards
Quick-fire cards for active recall
Syllabus
What topics to cover
For serious students
Get the full Sorting chapter — for free.
Quizzes, flashcards, AI doubt-solver and a step-by-step study plan for CBSE Class 12 Computer Science.