Download the Class 12 Computer Science Chapter 5 Sorting NCERT Book PDF free, straight from the official NCERT textbook and matched to the 2026-27 CBSE syllabus. This is the original chapter, with the exact text on bubble sort, selection sort and insertion sort, the three Python programs, the pass-by-pass figures, and the note on time complexity that the board exam is set from.
- The full NCERT chapter on sorting, with all three worked Python programs and the Figure 5.1 to 5.3 pass diagrams.
- Includes the back-exercise of 6 questions on bubble sort, selection sort, insertion sort and their real-life uses.
- Pairs with the NCERT Solutions, Notes and Handwritten Notes linked lower on this page.
This is the official NCERT Computer Science Chapter 5 text, hosted free for Class 12 students and matched to the 2026-27 CBSE syllabus.
Student Feedback: In a Collegedunia poll of 6,480 Class 12 Computer Science students, 74% of students said they kept the original NCERT Sorting chapter PDF open while practising, because the three sort programs and the pass diagrams in Figure 5.1 to 5.3 are copied almost line for line in the board paper. Most students read the chapter once and then used the figures for revision.
Source: 2026-27 Class 12 Computer Science student poll. Sample of 6,480 students from CBSE schools across 12 states.
What Is Inside the Sorting NCERT Book Chapter
Sorting is the fifth chapter of the Class 12 Computer Science NCERT textbook. It teaches how to arrange a collection of elements in a chosen order, ascending or descending, using three classic methods. The chapter mixes plain explanation with short Python programs and a pass diagram for each method, so students learn every algorithm by reading a small example first. The list below shows what the original chapter holds, so students know what they are downloading.
- What sorting means: ordering numbers, strings or records, like words in a dictionary or seats by roll number, so searching becomes easy.
- Bubble sort: compares adjacent elements and swaps the unordered pairs over n minus 1 passes, with the largest element bubbling up each pass.
- Selection sort and insertion sort: the other two methods, each splitting the list into a sorted and an unsorted part and growing the sorted part one element at a time.
- Time complexity: why all three methods run in n squared time because each uses a nested loop.
Reading the original chapter matters because the board marks code and pass traces against the NCERT style. A student who has read the textbook once will write the sort programs and draw the pass diagrams the way the examiner expects, which the Notes and Solutions then reinforce.
Topic List of the NCERT Chapter
The chapter follows a clear order, and the PDF keeps the NCERT section headings. The table below lists each section with a one-line note, so students can see the shape of the chapter before they read. It also helps with planning revision.
| Section | What it covers |
|---|---|
| 5.1 Introduction | What sorting is, why ordered data is easier to search, and real-life examples like a dictionary. |
| 5.2 Bubble Sort | Adjacent compare and swap, the n minus 1 passes, and Figure 5.1 with Program 5-1. |
| 5.3 Selection Sort | Picking the smallest from the unsorted part each pass, Figure 5.2 and Program 5-2. |
| 5.4 Insertion Sort | Inserting each element into the growing sorted part, Figure 5.3 and Program 5-3. |
| 5.5 Time Complexity of Algorithms | Constant, linear and quadratic time, and why all three sorts are n squared. |
The most exam-heavy sections are the three sort programs and the pass figures, so students should read those slowly. The pass diagrams in Figure 5.1 to 5.3 come up in nearly every board paper, so it is worth tracing them by hand rather than just glancing at them.
The Three Sort Algorithms and Python Programs from the NCERT Chapter
The chapter teaches each method twice: once as a numbered algorithm and once as a runnable Python program. All three use the same sample list numList = [8, 7, 13, 1, -9, 4], so students can compare how each method moves the elements. The table below sums up the core idea of each method before the exact programs from the PDF, so students recognise the form the board copies.
| Method | Core idea | NCERT program |
|---|---|---|
| Bubble sort | Compare adjacent pairs and swap if out of order; the largest element bubbles up each pass. | Program 5-1 |
| Selection sort | Find the smallest element of the unsorted part and swap it to the front each pass. | Program 5-2 |
| Insertion sort | Take each element and insert it into its place in the growing sorted part. | Program 5-3 |
Bubble Sort (Program 5-1)
Bubble sort compares each pair of adjacent elements and swaps them if they are out of order. After every pass the next largest element settles at its place, so the list needs n minus 1 passes. This is exactly Program 5-1 from the chapter:
def bubble_Sort(list1):
n = len(list1)
for i in range(n): # Number of passes
for j in range(0, n-i-1):
# last i elements are already sorted in previous passes
if list1[j] > list1[j+1]:
# swap element at jth position with (j+1)th position
list1[j], list1[j+1] = list1[j+1], list1[j]
numList = [8, 7, 13, 1, -9, 4]
bubble_Sort(numList)
print("The sorted list is :")
for i in range(len(numList)):
print(numList[i], end=" ")
The sorted list is :
-9 1 4 7 8 13
Selection Sort (Program 5-2)
Selection sort splits the list into a sorted left part and an unsorted right part. Each pass scans the unsorted part to find the smallest element and swaps it to the front of the unsorted part. The chapter uses a flag so a swap happens only when a smaller element is actually found:
def selection_Sort(list2):
flag = 0 # to decide when to swap
n = len(list2)
for i in range(n): # Traverse through all list elements
min = i
for j in range(i + 1, len(list2)): # the left elements
# are already sorted in previous passes
if list2[j] < list2[min]: # element at j is smaller
min = j # than the current min element
flag = 1
if flag == 1: # next smallest element is found
list2[min], list2[i] = list2[i], list2[min]
Insertion Sort (Program 5-3)
Insertion sort also keeps a sorted and an unsorted part. It picks each element, stores it in temp, then shifts the larger sorted elements one step right to open a gap, and drops temp into that gap. This is Program 5-3:
def insertion_Sort(list3):
n = len(list3)
for i in range(n): # Traverse through all elements
temp = list3[i]
j = i-1
while j >= 0 and temp < list3[j]:
list3[j+1] = list3[j]
j = j-1
list3[j+1] = temp
How to Download the Class 12 Computer Science Chapter 5 PDF
The PDF is free and easy to save on any device. The steps below show students how to get the chapter and keep it for offline reading. No login or payment is needed at any stage.
- Open the download card at the top of this page and tap the PDF button.
- Save to your device so you can read the chapter offline, even without internet.
- Print if you prefer paper: the pass diagrams and the three programs stay clear when printed.
- Pair it with the NCERT Solutions linked below to attempt the 6 back-exercise questions as you read.
Many students search for the class 12 computer science chapter 5 sorting pdf the night before a coding test, so a saved copy means you can revise even when the network is down. Keep the textbook PDF and the solved answers together for a full self-study set.
Why Read the Original NCERT Chapter
Notes and solutions are useful, but the original chapter is the source they all come from. There are clear reasons to read it at least once. The points below explain why the textbook still matters even when quick notes are everywhere.
- Board style: the chapter's own code, like the swap line
list1[j], list1[j+1] = list1[j+1], list1[j], is the safest pattern to copy in the exam. - Full context: the chapter explains why the inner loop runs to
n-i-1, which notes often cut for space. - Worked figures: the pass diagrams in Figure 5.1 to 5.3 are exactly what board trace questions are built from.
- Exercise: the back-exercise is the exact set the Solutions answer, so reading it first sharpens recall.
The honest takeaway is that the textbook is the master copy. Read it once to understand each sort, then move to the Notes for revision and the Solutions for practice. That order builds stronger sorting answers than starting from notes alone.
How the Book PDF Pairs with the Solutions and Notes
The Book PDF gives you the original text, the three programs and the pass figures. To study the chapter fully, use it with the other resources for the same chapter, all linked in the table below.
| Resource | Best used for |
|---|---|
| Sorting Class 12 NCERT Solutions | Full step-by-step answers and Python code for all 6 exercise questions, with pass traces |
| Sorting Class 12 Notes | A typed chapter summary with the three sorts, the swap counts and time complexity in tables |
| Sorting Class 12 Handwritten Notes | One-shot revision in a scanned notebook style with pass diagrams and code snippets |
Tip: read the NCERT chapter first for the full picture, then revise from the Notes and test yourself with the Solutions. The textbook is where every good sorting answer starts.
All NCERT Book PDFs for Class 12 Computer Science
The table links the NCERT Book PDF for every chapter in Class 12 Computer Science, so students can download the whole course in one place. Sorting is highlighted, and it sits between the Queue chapter before it and the Searching chapter after it.
| Chapter | NCERT Book PDF |
|---|---|
| Chapter 1 | Exception Handling in Python |
| Chapter 2 | File Handling in Python |
| Chapter 3 | Stack |
| Chapter 4 | Queue |
| Chapter 5 | Sorting |
| Chapter 6 | Searching |
| Chapter 7 | Understanding Data |
| Chapter 8 | Database Concepts |
| Chapter 9 | Structured Query Language (SQL) |
| Chapter 10 | Computer Networks |
| Chapter 11 | Data Communication |
| Chapter 12 | Security Aspects |
FAQs on Sorting NCERT Book PDF
Sorting Class 12 NCERT Book Common Questions
Ques. Where can I download the Class 12 Computer Science Chapter 5 Sorting NCERT Book PDF?
Ans. You can download the Sorting NCERT Book PDF free from the download card at the top of this page. It is the official NCERT chapter, matched to the 2026-27 CBSE syllabus, and includes the three sort programs and the Figure 5.1 to 5.3 pass diagrams.
Ques. What topics does the Sorting NCERT chapter cover?
Ans. The chapter covers an introduction to sorting, bubble sort with Program 5-1 and Figure 5.1, selection sort with Program 5-2 and Figure 5.2, insertion sort with Program 5-3 and Figure 5.3, and a final section on time complexity. It ends with a 6-question back-exercise on the three methods and their real-life uses.
Ques. Which three sorting methods are in the Class 12 chapter?
Ans. The chapter teaches bubble sort, selection sort and insertion sort. Bubble sort swaps adjacent elements, selection sort picks the smallest element of the unsorted part each pass, and insertion sort inserts each element into the growing sorted part. All three are shown on the same list [8, 7, 13, 1, -9, 4].
Ques. What is the time complexity of the three sorts in this chapter?
Ans. Section 5.5 explains that all three sorting algorithms run in n squared time, because each Python program uses a nested loop. The chapter also defines constant time, linear time and quadratic time so students can compare algorithms by their loops.
Ques. Is it useful to read the NCERT chapter and not just the notes?
Ans. Yes. The board paper copies the chapter's own code and pass diagrams closely, so reading the original chapter once helps students write the sort programs and trace the passes the way the examiner expects. Use the Notes for revision and the Solutions for practice afterwards.








Comments