Skip to content
Computing · Year 11

Active learning ideas

Searching Algorithms: Linear and Binary Search

Active learning helps students grasp how linear and binary search behave in real code rather than memorizing definitions. By coding, racing, and debating, they experience the trade-offs between simplicity and speed firsthand, building lasting intuition for when each algorithm fits.

National Curriculum Attainment TargetsGCSE: Computing - AlgorithmsGCSE: Computing - Computational Thinking
20–35 minPairs → Whole Class4 activities

Activity 01

Stations Rotation25 min · Pairs

Pair Programming: Linear Search Code-Off

Pairs write a linear search function in Python and test it on unsorted lists of 10, 100, and 1,000 items. They time runs using time module and graph results. Discuss findings: why does time grow linearly?

Compare the efficiency of linear search versus binary search for sorted data.

Facilitation TipDuring the Pair Programming Linear Search Code-Off, circulate and ask each pair to verbalize the loop condition and comparison before running the code to reinforce trace skills.

What to look forPresent students with a small, unsorted list of numbers and a target value. Ask them to trace the steps of a linear search to find the target, noting how many comparisons are made. Then, ask them to explain why binary search would not be applicable here.

RememberUnderstandApplyAnalyzeSelf-ManagementRelationship Skills
Generate Complete Lesson

Activity 02

Stations Rotation35 min · Small Groups

Small Groups: Binary Search Race

Groups implement binary search on sorted arrays, compare runtimes against linear search on the same data. Use stopwatches for manual simulations first, then code. Predict and verify halvings per step on a projector.

Predict the performance of a linear search on a very large, unsorted dataset.

Facilitation TipIn the Binary Search Race, provide identical datasets to each small group so results are comparable, and insist on a written record of each mid-point calculation.

What to look forPose the scenario: 'You are building a search feature for a website that lists 10,000 items. The list is sorted alphabetically. Which search algorithm would you choose, linear or binary, and why? What would change if the list was not sorted?' Facilitate a class discussion comparing student reasoning.

RememberUnderstandApplyAnalyzeSelf-ManagementRelationship Skills
Generate Complete Lesson

Activity 03

Stations Rotation20 min · Whole Class

Whole Class: Efficiency Debate

Project real-world scenarios like phone contacts or library catalogs. Class votes on best algorithm, justifies with prior timings. Teacher tallies and reveals optimal choices based on sorted/unsorted status.

Justify when a linear search might be preferred over a binary search.

Facilitation TipFor the Efficiency Debate, assign roles (linear advocate, binary advocate, data analyst) so every student has a stake in the reasoning, not just the confident speakers.

What to look forOn a slip of paper, have students write down one advantage of linear search and one advantage of binary search. Then, ask them to predict which algorithm would be faster for finding a name in a phone book (sorted) and which would be better for finding a specific word in a scrambled paragraph (unsorted).

RememberUnderstandApplyAnalyzeSelf-ManagementRelationship Skills
Generate Complete Lesson

Activity 04

Stations Rotation30 min · Individual

Individual: Prediction Challenge

Students predict search times for datasets before coding tests. Run linear and binary on their machines, log discrepancies in a table. Share surprises in plenary.

Compare the efficiency of linear search versus binary search for sorted data.

What to look forPresent students with a small, unsorted list of numbers and a target value. Ask them to trace the steps of a linear search to find the target, noting how many comparisons are made. Then, ask them to explain why binary search would not be applicable here.

RememberUnderstandApplyAnalyzeSelf-ManagementRelationship Skills
Generate Complete Lesson

A few notes on teaching this unit

Teach binary search by starting with a physical number line and a volunteer ‘searcher’ to model halving steps, then move to pseudocode before coding. Avoid rushing to the logarithm formula; instead, have students count steps on small lists until the pattern emerges. Research shows that concrete-to-abstract sequencing prevents the ‘magic trick’ feeling many students report with binary search.

Students will confidently implement both algorithms, justify their choices based on dataset size and order, and articulate the difference between O(n) and O(log n) complexity. They will use timing data and step counts to explain rather than guess which algorithm suits which problem.


Watch Out for These Misconceptions

  • During the Binary Search Race, watch for students who run the algorithm on unsorted lists without sorting first, producing incorrect results.

    Pause the race and ask each group to verify their list is sorted by checking adjacent pairs before re-running; this reinforces that binary search relies on sorted data.

  • During the Pair Programming Linear Search Code-Off, watch for students who assume linear search is always slower than binary search even on tiny unsorted lists.

    Have each pair time their linear search on a list of 5 items versus their binary search attempt on the same unsorted list to see binary fail and linear succeed, then discuss preprocessing trade-offs.

  • During the Efficiency Debate, watch for students who describe binary search as checking every other item like a skip-list.

    Use the number line visualization from the binary search demo to show how each step eliminates half the remaining items, not just one, and ask students to redraw their steps to match.


Methods used in this brief