Skip to content
Computer Science · Grade 12

Active learning ideas

Searching Algorithms

Searching algorithms come alive when students physically act out the steps, which builds intuition for time complexity better than abstract slides. Pairing movement with code deepens engagement and highlights why efficiency matters, especially when data grows large.

Ontario Curriculum ExpectationsCS.AA.10CS.P.20
30–50 minPairs → Whole Class4 activities

Activity 01

Stations Rotation50 min · Pairs

Pair Programming: Efficiency Timer

Pairs write linear and binary search functions in Python, test on arrays from 10 to 10,000 elements, and log execution times. They plot graphs using matplotlib to compare growth rates. Pairs present findings on best uses for each algorithm.

Differentiate between linear search and binary search in terms of their prerequisites and efficiency.

Facilitation TipDuring Pair Programming: Efficiency Timer, ask pairs to swap roles every two minutes so both students experience timing and code adjustments directly.

What to look forProvide students with three scenarios: 1) A large, sorted list of student IDs. 2) A frequently changing list of online user sessions. 3) A small, unsorted list of product names. Ask students to write down the most appropriate search algorithm for each scenario and a one-sentence justification.

RememberUnderstandApplyAnalyzeSelf-ManagementRelationship Skills
Generate Complete Lesson

Activity 02

Stations Rotation30 min · Small Groups

Binary Search: Number Guessing Relay

Small groups line up; the teacher thinks of a number between 1 and 1000. Students ask yes/no questions to halve the range, passing the turn after each guess. Time the full search and debrief on steps versus linear counting.

Explain why binary search is significantly faster than linear search for large, sorted datasets.

Facilitation TipBefore Binary Search: Number Guessing Relay, have students sort their guesses on paper first to reinforce the prerequisite of sorted data.

What to look forOn an index card, ask students to define 'time complexity' in their own words and then explain why binary search is faster than linear search for large, sorted datasets.

RememberUnderstandApplyAnalyzeSelf-ManagementRelationship Skills
Generate Complete Lesson

Activity 03

Stations Rotation40 min · Small Groups

Hash Table: Dictionary Dash

Provide printed dictionaries; students create simple hash functions for names (e.g., sum of letter positions modulo page count). Practice lookups and compare times to sequential scans in unsorted lists. Groups tally averages and discuss collisions.

Design a search strategy for a dataset that is frequently updated but rarely queried.

Facilitation TipIn Hash Table: Dictionary Dash, place a timer at the front of the room so students can watch how quickly items are retrieved and see collisions emerge.

What to look forPose the question: 'Imagine you are designing a search feature for a music streaming service. What data structure and search algorithm would you recommend, and why? Consider how users search for songs and how the music library changes.' Facilitate a class discussion comparing different student choices.

RememberUnderstandApplyAnalyzeSelf-ManagementRelationship Skills
Generate Complete Lesson

Activity 04

Stations Rotation35 min · Whole Class

Whole Class: Algorithm Tournament

Divide class into teams representing algorithms. Pose search problems on projected datasets; teams shout strategies and predict winner times. Vote and verify with code demos, reinforcing efficiency intuitions.

Differentiate between linear search and binary search in terms of their prerequisites and efficiency.

Facilitation TipDuring the Algorithm Tournament, assign a student scorekeeper to track wins and losses on a whiteboard so the class sees patterns across rounds.

What to look forProvide students with three scenarios: 1) A large, sorted list of student IDs. 2) A frequently changing list of online user sessions. 3) A small, unsorted list of product names. Ask students to write down the most appropriate search algorithm for each scenario and a one-sentence justification.

RememberUnderstandApplyAnalyzeSelf-ManagementRelationship Skills
Generate Complete Lesson

A few notes on teaching this unit

Teach searching algorithms by starting with concrete, embodied tasks before moving to abstract code, because motion helps students internalize the difference between linear and logarithmic steps. Avoid rushing to formulas; instead, use repeated timing trials to let students discover time complexity through experience. Research shows that students grasp asymptotic behavior more deeply when they feel the ‘cost’ of each search through real-world analogies like sorting stacks of papers or racing to find a name in a phone book.

Successful learners will compare algorithms’ prerequisites and trade-offs, justify choices based on dataset size and order, and articulate why O(1), O(log n), and O(n) matter in real systems. They will also debug common misconceptions by testing edge cases during hands-on tasks.


Watch Out for These Misconceptions

  • During Binary Search: Number Guessing Relay, watch for students who guess without checking if the list is sorted first.

    Before starting the relay, have teams sort their lists on the board and verify the order together. Then, run a quick test with an unsorted list to show how the algorithm fails, prompting students to explain why sorting is non-negotiable.

  • During Pair Programming: Efficiency Timer, watch for students who assume linear search is always slower without testing small datasets.

    Challenge pairs to run their linear search on lists of 5, 50, and 500 items, then graph the times on the whiteboard. Ask them to explain why linear search can outperform binary search for tiny, unsorted data.

  • During Hash Table: Dictionary Dash, watch for students who believe hash tables never have collisions.

    Give students a simple hash function with a poor distribution, like modulo by 3, and watch collisions pile up. Ask them to adjust the function or add chaining, then test retrieval speeds to see how collisions affect performance.


Methods used in this brief