The Sorting Class 12 Computer Science handwritten notes have been carefully prepared by hand for quick one-shot revision, according to the latest 2026-27 CBSE syllabus. They cover bubble sort, selection sort and insertion sort with pass-by-pass dry runs, boxed Python code, the count of passes, comparisons and swaps each one needs, and the time complexity that decides which sort is faster on a large list.
- CBSE Weightage: 4 to 6 marks from Unit 1 (Computational Thinking and Programming), shared with Searching.
- Boxed keywords and hand-written code blocks for all three sorts, plus a side-by-side swap-count table.
- Pairs with the NCERT Solutions, Notes and Book PDF linked lower on this page.
These Sorting handwritten notes are prepared from the official NCERT Computer Science textbook and matched to the 2026-27 CBSE syllabus.

Student Feedback: In a Collegedunia poll of 11,800 Class 12 Computer Science students before the 2026 boards, 71% of students said the hand-drawn swap-count table for bubble versus selection sort was the single fastest way to revise this chapter. Most students copied the boxed dry-run tables straight onto practice answer sheets.
Source: 2026-27 Class 12 Computer Science student poll. Sample of 11,800 students from CBSE schools across 14 states.
What These Sorting Class 12 Computer Science Handwritten Notes Include
Typed notes read like a textbook. Handwritten notes read like a friend's revision book, so the eye finds the keyword fast on exam day. These Sorting handwritten notes condense the whole chapter into 24 handwritten pages of ruled paper, with every Python keyword in a box, every dry run drawn pass by pass, and each swap count circled in the margin.
The pages are built around the three threads that the CBSE board paper tests:
- The three moves: what a pass, a comparison and a swap mean, and how all three sorts share them.
- The three sorts: bubble, selection and insertion sort, each with a boxed program, a dry run, and the output.
- Time complexity: why all three sorts are quadratic, and a swap-count table to pick the cheaper sort.
Because the notes are handwritten, the code blocks sit in pen-drawn boxes and the dry-run tables are drawn by hand, so locating a single pass during last-week revision takes seconds. This makes the set ideal for a fast recap the night before the exam.

Pass, Comparison and Swap: The First Page of the Notes
The opening page fixes the three words that every sort uses, so the rest of the chapter reads easily. The notes box each term with a one-line meaning, then show the Python swap line that all three sorts reuse.
- Pass: one full sweep through the list. After each pass, a little more of the list is in order.
- Comparison: checking two elements to see which is bigger, so you know whether to move them.
- Swap: exchanging the places of two elements so they sit correctly.
The notes box this one-line swap, because Python does it without a temporary variable. The right side is packed into a pair first, then unpacked into the left side, so no value is lost:
list1 = [8, 3]
list1[0], list1[1] = list1[1], list1[0]
print(list1)
[3, 8]
The margin note underlines the takeaway: sorting is just many comparisons and swaps, grouped into passes. A handy mnemonic boxed on this page for the study order is "Big Sorts Inside", which stands for Bubble, Selection, Insertion.
Bubble Sort Page: Boxed Code and Dry Run
Bubble sort is the first and simplest method, so it gets the most worked page. The notes draw the idea first: walk through the list, compare each pair of neighbours, and swap them if they are out of order, so the largest value floats to the end each pass like a bubble in water.
- For a list of
nelements, bubble sort makes n-1 passes. - In pass number
i, it makesn-i-1comparisons, because the lastielements are already in place. - If a whole pass makes no swap, the list is already sorted and you can stop early.
The boxed program below mirrors the page. The outer loop drives the passes and the inner loop compares neighbours, swapping with the one-line trick. The key is the inner bound n-i-1, which shrinks as i grows, so later passes do less work:
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 items already sorted
if list1[j] > list1[j+1]:
# swap the jth and (j+1)th elements
list1[j], list1[j+1] = list1[j+1], list1[j]
numList = [8, 7, 13, 1, -9, 4]
bubble_Sort(numList)
print(numList)
[-9, 1, 4, 7, 8, 13]
The margin boxes the descending-order edit: flip the comparison from greater-than to less-than, so the smallest value bubbles down to the end. Examiners love this one-line change, so the notes circle the single sign that flips rather than rewriting the whole program.

Selection Sort Page: Pick the Smallest Each Pass
Selection sort gets its own page because it counts swaps very differently. The notes draw the list split into a sorted part on the left, empty at the start, and an unsorted part on the right. Each pass finds the smallest value in the unsorted part and swaps it to the front, growing the sorted part by one.
- For
nelements, selection sort makes n-1 passes. - Each pass scans the unsorted part once to find the smallest value.
- It makes at most one swap per pass, far fewer than bubble sort.
The boxed program records the index of the smallest value in min, and a flag turns on only if a smaller value appears, so a needless swap is skipped:
def selection_Sort(list2):
n = len(list2)
for i in range(n): # one pass per position
min = i
flag = 0
for j in range(i+1, n): # scan the unsorted part
if list2[j] < list2[min]:
min = j
flag = 1
if flag == 1: # a smaller value was found
list2[min], list2[i] = list2[i], list2[min]
numList = [8, 7, 13, 1, -9, 4]
selection_Sort(numList)
print(numList)
[-9, 1, 4, 7, 8, 13]
The margin note boxes the exam line students miss: store the position of the smallest value, not the value itself. You need the index to swap correctly. Selection sort wins when moving an element is expensive, such as swapping heavy records, because it makes only one swap per pass.
Insertion Sort Page: Insert Into the Sorted Part
Insertion sort works the way you sort playing cards in your hand, and the notes draw it that way. It picks the next unsorted value and slides it back into the sorted part until it sits in the right place, shifting larger sorted values one step right to make room. The first element is treated as a sorted list of size one.
Unlike bubble sort, insertion sort does not swap pairs. It shifts each larger sorted value one place to the right, opens a gap, and drops the picked value into that gap. The boxed program saves the picked value in temp before any shift:
def insertion_Sort(list3):
n = len(list3)
for i in range(n): # traverse all elements
temp = list3[i]
j = i-1
while j >= 0 and temp < list3[j]:
list3[j+1] = list3[j] # shift larger value right
j = j-1
list3[j+1] = temp # insert temp at its place
numList = [8, 7, 13, 1, -9, 4]
insertion_Sort(numList)
print(numList)
[-9, 1, 4, 7, 8, 13]
A boxed note records the property that earns marks: a value never jumps over an equal one, so two equal values keep their order. A sort that preserves the order of equal values is a stable sort, and insertion sort is the fastest of the three on a list that is already nearly sorted, because a value already in place does almost no work.
Time Complexity and the Swap-Count Table in the Notes
The last content page settles which sort to pick. The notes box the four NCERT rules that read time complexity straight off the loops, then apply them to the three sorts. Because each sort has a loop inside a loop, each one is quadratic, written n2.
| Structure of the code | Type | Complexity |
|---|---|---|
| No loop at all | Constant time | 1 |
| A single loop, 1 to n | Linear time | n |
| A loop inside a loop | Quadratic time | n2 |
| A nested loop plus a single loop | Counted by the nested loop | n2 |
The notes draw a swap-count table for the classic reverse-order list, because it answers the most common 3-mark board question in one glance. For List 1 = 63, 42, 21, 9, bubble sort swaps six times while selection sort swaps only twice, even though both make the same n(n-1)/2 = 4 × 3 / 2 = 6 comparisons.
| Feature | Bubble | Selection | Insertion |
|---|---|---|---|
| Passes | n-1 | n-1 | n-1 |
| Main idea | swap adjacent pairs | select the smallest | insert into sorted part |
| Swaps per pass | many possible | at most one | shifts, not swaps |
| Swaps on 63,42,21,9 | 6 | 2 | shifts only |
| Complexity | n2 | n2 | n2 |
The margin underlines the one-line fact that answers many short questions without tracing the whole sort: for n elements, bubble and selection sort both make n(n-1)/2 comparisons in total. When a swap is costly, selection sort is the better pick because it moves elements the least.
How to Use These Handwritten Notes Effectively
Handwritten notes work best as a final layer of revision, not as your first read. The plan below helps students get the most out of the Sorting handwritten notes before the board and practical exams. Follow it once a week in the run-up to the test.
- First pass: read the pages in order, the three moves, then bubble, selection and insertion sort.
- Active recall: cover the boxed code and try to write each sort from memory, line by line.
- Trace by hand: dry run each sort on
[8, 7, 13, 1, -9, 4], writing the list after every pass. - Self-test: count swaps for 63, 42, 21, 9 under bubble and selection sort to lock the swap rule.
Because the notes come as a downloadable PDF, students can save them on a phone and revise offline on the way to the exam centre. Many students open the sorting class 12 computer science notes on their phone the night before a test, so a saved PDF means revision is always at hand. Pair these pages with the full solutions to check your written code against model answers.
Common Mistakes These Notes Help You Avoid
A few errors cost marks in this chapter every year. Most come from miscounting passes, mixing up swaps and shifts, or giving the three sorts different complexities. The notes flag each soft point in the margin so students phrase it safely on the answer sheet.
- Saying bubble sort needs n passes. It needs
n-1passes, and the inner loop runs ton-i-1, notn. - Claiming selection sort makes many swaps. It makes at most one swap per pass; its comparison count is the high one.
- Losing the picked value in insertion sort. Save it in
tempbefore you start shifting. - Giving the three sorts different complexities. All three are quadratic, n2, because each has a nested loop.
- Forgetting the descending edit. Only the comparison sign flips (
>to<), not the whole program.
Students who fix these five points usually move from average to high marks. The exam rewards exact counts and clean code, so always state n-1 passes, name swap versus shift correctly, and call all three sorts quadratic. The handwritten margin notes nudge you to keep that precision in the right places.
How These Notes Pair with the Solutions and Book PDF
These handwritten notes are a revision layer. To prepare fully, students should use them with the other resources for the same chapter, all linked in the table below. Read the notes, then test yourself with the solutions, and open the book PDF for the original text.
| Resource | Best used for |
|---|---|
| Sorting NCERT Solutions | Step-by-step code and dry runs for all 6 back-exercise questions |
| Sorting Class 12 Notes | Quick typed summary with every sort, dry run and time complexity rule |
| Sorting NCERT Book PDF | Reading the original NCERT chapter text from the textbook |
Tip: redraw the swap-count table for 63, 42, 21, 9 once from memory, then trace one sort line by line. Doing that once fixes the difference between swaps and shifts for good.
All Class 12 Computer Science Handwritten Notes by Chapter
The table links the handwritten notes for every chapter in Class 12 Computer Science, so students can move across the course in one click. Sorting is highlighted, with Queue before it and Searching after it.
| Chapter | Handwritten Notes |
|---|---|
| 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 Handwritten Notes
Sorting Class 12 Computer Science Handwritten Notes Common Questions
Ques. Are these class 12 computer science chapter 5 Sorting handwritten notes free to download?
Ans. Yes. The Sorting handwritten notes are free to download as a PDF from this page. They follow the 2026-27 NCERT syllabus and cover the full chapter across 24 handwritten, boxed-keyword pages, with bubble, selection and insertion sort dry runs for quick revision.
Ques. What does Sorting cover in Class 12 Computer Science?
Ans. The notes cover the three moves of a pass, a comparison and a swap, then the three classic sorts: bubble sort, selection sort and insertion sort. Each sort gets a boxed Python program, a pass-by-pass dry run and its output. The chapter ends with the time complexity rules, which show that all three sorts are quadratic, n squared.
Ques. What is the difference between bubble sort, selection sort and insertion sort?
Ans. Bubble sort compares adjacent pairs and swaps them, so the largest value bubbles to the end each pass and it may swap many times. Selection sort picks the smallest value from the unsorted part and makes at most one swap per pass. Insertion sort inserts each value into the sorted part by shifting larger values right, which makes it fastest on a nearly sorted list. All three make n-1 passes and all three are n squared in time complexity.
Ques. How many swaps does selection sort make compared to bubble sort?
Ans. Selection sort makes at most one swap per pass, because it first finds the index of the smallest unsorted value and then performs a single swap. Bubble sort may swap many times in one pass. For a fully reversed list such as 63, 42, 21, 9, selection sort needs only two swaps while bubble sort needs six, even though both make the same n(n-1)/2 comparisons.
Ques. Why is the time complexity of all three sorts n squared?
Ans. Time complexity describes how the work grows as the list size n increases. The NCERT rule says a single loop is linear time, written n, while a loop inside another loop is quadratic time, written n squared. Each of the three sorting programs has an outer loop driving the passes and an inner loop that compares or shifts, so each one is a nested loop and is therefore quadratic.
Ques. Are these notes enough for the class 12 computer science chapter 5 board exam?
Ans. They are a strong final revision layer. For full preparation, pair them with the NCERT Solutions linked on this page so you can write out complete code answers to all 6 back-exercise questions, trace the dry runs, and check the swap counts against model answers.








Comments