Skip to content
Computer Science · Class 12

Active learning ideas

Sorting Algorithms: Insertion Sort Implementation

Active learning helps students grasp sorting algorithms because abstract concepts become concrete through hands-on practice. For insertion sort, tracing each step with physical objects or code makes the shifting process visible and memorable, which is essential for understanding why it builds the sorted portion from left to right.

CBSE Learning OutcomesCBSE: Computational Thinking and Programming - Idea of Efficiency - Class 12
25–40 minPairs → Whole Class4 activities

Activity 01

Experiential Learning30 min · Small Groups

Hands-on Simulation: Card Sort Relay

Distribute shuffled cards numbered 1-20 to small groups. One student sorts by insertion method while others time and count shifts. Groups compare results and discuss observations. Rotate roles for two rounds.

Describe the step-by-step process of insertion sort.

Facilitation TipDuring the Card Sort Relay, ensure students physically move cards in the sorted portion to show how larger elements shift right to make space for the new element.

What to look forPresent students with a partially sorted list, e.g., [5, 1, 4, 2, 8]. Ask them to write down the state of the list after the third element (4) has been inserted into the sorted portion [1, 5]. This checks their understanding of the insertion step.

ApplyAnalyzeEvaluateSelf-AwarenessSelf-ManagementSocial Awareness
Generate Complete Lesson

Activity 02

Experiential Learning40 min · Pairs

Pair Programming: Implement Insertion Sort

Pairs write Python code for insertion sort on given arrays. Test with random, sorted, and reverse-sorted inputs. Debug together and note swap counts. Share one insight with class.

Compare insertion sort's efficiency with bubble sort for nearly sorted data.

Facilitation TipWhen students pair program, encourage them to test with at least two arrays: one nearly sorted and one reverse sorted, to observe the algorithm’s adaptive nature.

What to look forOn a small slip of paper, ask students to write: 1. One advantage of insertion sort over bubble sort for nearly sorted data. 2. One scenario where insertion sort is a good choice. This assesses their comparative analysis and justification skills.

ApplyAnalyzeEvaluateSelf-AwarenessSelf-ManagementSocial Awareness
Generate Complete Lesson

Activity 03

Experiential Learning25 min · Whole Class

Whiteboard Walkthrough: Trace Execution

Whole class traces insertion sort on a large array drawn on whiteboard. Teacher or student leads, marking sorted portion and shifts with arrows. Pause for predictions at each step.

Justify why insertion sort might be preferred for small datasets.

Facilitation TipFor the Whiteboard Walkthrough, have students draw arrows to mark the boundaries of the sorted and unsorted portions with each insertion step.

What to look forFacilitate a class discussion: 'Imagine you are designing a system to sort user search results as they are typed. Would insertion sort be a suitable algorithm? Why or why not? Consider its time complexity and adaptive nature.'

ApplyAnalyzeEvaluateSelf-AwarenessSelf-ManagementSocial Awareness
Generate Complete Lesson

Activity 04

Experiential Learning35 min · Individual

Data Challenge: Efficiency Test

Individuals run insertion and bubble sort codes on datasets of size 10, 50, 100. Record execution times. Plot results and analyse trends in small group discussions.

Describe the step-by-step process of insertion sort.

Facilitation TipIn the Efficiency Test, provide a timer or counter so students can measure comparisons and shifts for different input sizes, reinforcing the empirical evidence.

What to look forPresent students with a partially sorted list, e.g., [5, 1, 4, 2, 8]. Ask them to write down the state of the list after the third element (4) has been inserted into the sorted portion [1, 5]. This checks their understanding of the insertion step.

ApplyAnalyzeEvaluateSelf-AwarenessSelf-ManagementSocial Awareness
Generate Complete Lesson

A few notes on teaching this unit

Experienced teachers approach insertion sort by first making the process visual and tactile, using card sorting to build intuition before moving to code. They avoid rushing to the Python implementation and instead focus on the mechanics of shifting elements. Research shows that students retain the concept better when they physically manipulate elements, so prioritize simulations over abstract explanations. Teachers should also highlight the algorithm’s adaptive nature by comparing its performance on different input types, which helps students move beyond the fixed O(n^2) myth.

Successful learning looks like students accurately simulating the algorithm with cards, writing correct Python code, and explaining the difference between comparisons and shifts. They should confidently trace the algorithm on small arrays and justify why insertion sort adapts to nearly sorted data.


Watch Out for These Misconceptions

  • During Hands-on Simulation: Card Sort Relay, watch for students treating insertion sort like bubble sort by swapping adjacent elements only.

    In the Card Sort Relay, emphasize that students must shift all larger elements in the sorted portion to the right at once to make space for the new element. Ask them to verbalize why multiple cards move together, not just adjacent swaps.

  • During Pair Programming: Implement Insertion Sort, watch for students assuming insertion sort always performs the same number of comparisons regardless of input order.

    After implementing the algorithm, have students test it on nearly sorted data, reverse sorted data, and random data. Ask them to count comparisons for each case and compare the results to highlight the adaptive nature of insertion sort.

  • During Whiteboard Walkthrough: Trace Execution, watch for students starting the sorted portion from the end of the array.

    On the whiteboard, clearly label the leftmost element as the starting sorted portion. Use arrows to show how the sorted portion grows to the right with each insertion, and ask students to predict the next step actively.


Methods used in this brief