Skip to content
Computer Science · Class 12

Active learning ideas

Searching Algorithms: Linear Search Implementation

Active learning makes linear search tangible for students because they physically or visually step through each comparison, which helps them grasp why the algorithm must check every element until it finds a match. When students simulate the process with real objects or race code against timers, the abstract O(n) complexity becomes concrete and memorable.

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

Activity 01

Stations Rotation30 min · Pairs

Pair Programming: Linear Search Code-Off

Pairs write a Python function for linear search on an unsorted list. Test with 5 inputs: found early, found late, not found. Swap codes to debug partner's version and note comparisons.

Explain the process of a linear search algorithm.

Facilitation TipDuring Pair Programming: Linear Search Code-Off, assign roles clearly—one student types while the other reads and checks each line against the traced steps from the Small Groups activity.

What to look forProvide students with a small unsorted list of numbers (e.g., [15, 8, 23, 4, 42, 16]) and a target number (e.g., 42). Ask them to write down the sequence of comparisons the linear search would make and state the final index returned.

RememberUnderstandApplyAnalyzeSelf-ManagementRelationship Skills
Generate Complete Lesson

Activity 02

Stations Rotation25 min · Small Groups

Small Groups: Card Search Simulation

Distribute shuffled cards numbered 1-20 to groups. One student hides a target card; others perform linear search aloud, counting steps. Repeat with larger decks and record average comparisons.

Evaluate the efficiency of linear search for small versus large datasets.

Facilitation TipDuring Small Groups: Card Search Simulation, use a shuffled deck of numbered cards so students experience the algorithm on truly unsorted data and feel the variability in steps.

What to look forAsk students to write a Python function stub for linear search that takes a list and a target value. They should include comments explaining the purpose of each major step: initialization, loop, comparison, and return values for found/not found.

RememberUnderstandApplyAnalyzeSelf-ManagementRelationship Skills
Generate Complete Lesson

Activity 03

Stations Rotation35 min · Whole Class

Whole Class: Efficiency Timing Demo

Project code searching lists of size 100, 1000, 10000. Class predicts and times runs for targets at start, middle, end. Discuss patterns in a shared Google Sheet.

Predict the maximum number of comparisons a linear search might perform.

Facilitation TipDuring Whole Class: Efficiency Timing Demo, start with small lists and gradually increase size to show the linear growth visually on a whiteboard graph.

What to look forPose the question: 'If you had a list of 1 million student roll numbers and needed to find one specific roll number, would linear search be a good choice? Explain why or why not, considering its time complexity.'

RememberUnderstandApplyAnalyzeSelf-ManagementRelationship Skills
Generate Complete Lesson

Activity 04

Stations Rotation20 min · Individual

Individual: Step-by-Step Tracing

Provide pseudocode and array. Students pencil-trace 3 cases on worksheets, marking comparisons and predicting output before coding.

Explain the process of a linear search algorithm.

Facilitation TipDuring Individual: Step-by-Step Tracing, ask students to number each comparison on paper so you can collect and compare sequences to spot patterns.

What to look forProvide students with a small unsorted list of numbers (e.g., [15, 8, 23, 4, 42, 16]) and a target number (e.g., 42). Ask them to write down the sequence of comparisons the linear search would make and state the final index returned.

RememberUnderstandApplyAnalyzeSelf-ManagementRelationship Skills
Generate Complete Lesson

A few notes on teaching this unit

Teachers should start with the Card Search Simulation to build intuition, then move to tracing on paper before coding. Avoid rushing to the Python implementation; let students verbalise the steps aloud first. Research shows that tracing unsorted lists early prevents the misconception that sorting is required, and timing activities later build evidence for discussing Big-O notation.

By the end of these activities, students should confidently trace linear search steps on unsorted lists, explain why sorting is not required, and compare its performance with other algorithms using timing data. They should also be able to write and debug the Python implementation with clear comments.


Watch Out for These Misconceptions

  • During Pair Programming: Linear Search Code-Off, watch for students who skip elements or assume the list is sorted before searching.

    Ask pairs to place a marker on the code line where each element is checked and verify that the loop covers every index from 0 to len(list)-1 without assumptions.

  • During Whole Class: Efficiency Timing Demo, watch for students who average the time for one search and treat it as fixed for larger lists.

    Have groups plot timing data on graph paper and draw a line through the points to show the linear trend, then discuss why averages can vary but the slope stays consistent.

  • During Small Groups: Card Search Simulation, watch for students who stop searching after finding the target once, assuming no duplicates exist.

    Ask students to search for a repeated number and count how many times it appears, then discuss why linear search returns the first occurrence only.


Methods used in this brief