Skip to content
Computer Science · Grade 12

Active learning ideas

Common Time Complexities

Active learning builds intuition for abstract concepts like time complexity by making invisible processes visible. When students manipulate sorting steps or trace search operations with their hands, they connect mathematical notation to concrete experiences. This hands-on practice helps them internalize why an O(n log n) algorithm matters for large datasets, beyond memorizing definitions.

Ontario Curriculum ExpectationsCS.AA.3CS.DSAA.15
15–40 minPairs → Whole Class3 activities

Activity 01

Simulation Game40 min · Small Groups

Simulation Game: The Sorting Race

Divide the class into groups, each assigned a different sorting algorithm (Selection, Merge, Quick). Using a deck of cards, they must sort them following their specific 'rules' while a timer runs, then compare results.

Differentiate between an algorithm that is slow and one that is computationally intractable.

Facilitation TipDuring The Sorting Race, circulate with a timer and ask each group to explain why their chosen algorithm behaves as it does with their specific dataset.

What to look forPresent students with code snippets for simple algorithms (e.g., finding the maximum element in an array, checking for duplicates using nested loops). Ask them to identify the Big O complexity of each snippet and justify their answer by pointing to the relevant operations.

ApplyAnalyzeEvaluateCreateSocial AwarenessDecision-Making
Generate Complete Lesson

Activity 02

Gallery Walk30 min · Small Groups

Gallery Walk: Algorithm Visualizations

Display step-by-step diagrams of different sorts. Students move from station to station, identifying the 'pivot' in QuickSort or the 'split' in MergeSort, and answering questions about the current state of the data.

Explain the practical implications of moving from an O(n^2) to an O(n log n) solution.

Facilitation TipFor the Gallery Walk, assign each student to focus on one visualization and prepare a 60-second explanation of how the algorithm divides data or eliminates regions.

What to look forPose the scenario: 'You are developing a system to recommend movies to millions of users. One approach takes O(n^2) time, and another takes O(n log n) time. Explain to a non-technical manager why the O(n log n) approach is essential, even if it's slightly more complex to implement initially. What are the potential consequences of choosing the slower algorithm?'

UnderstandApplyAnalyzeCreateRelationship SkillsSocial Awareness
Generate Complete Lesson

Activity 03

Think-Pair-Share15 min · Pairs

Think-Pair-Share: The Best Tool for the Job

Present scenarios (e.g., sorting a list that is already 90% sorted). Pairs discuss which algorithm would be fastest for that specific case and why, then share their reasoning with the class.

Predict the performance of an algorithm given its Big O classification for varying input sizes.

Facilitation TipIn Think-Pair-Share, provide printed code snippets for students to annotate with Big O labels before discussing in pairs.

What to look forProvide students with a table showing input sizes (e.g., 10, 100, 1000, 10000) and corresponding 'operations' for different Big O complexities (e.g., O(n) operations for O(n)). Ask them to calculate the approximate number of operations for O(n^2) and O(log n) at the largest input size and comment on the difference.

UnderstandApplyAnalyzeSelf-AwarenessRelationship Skills
Generate Complete Lesson

A few notes on teaching this unit

Teachers should start with physical analogies before introducing code, like sorting playing cards or finding a name in a phone book. Avoid rushing to formal definitions—instead, let students experience the frustration of slow algorithms before naming their inefficiencies. Research suggests that students grasp O(log n) best when they trace binary search on a number line they draw themselves, rather than watching a pre-made animation.

Successful learning looks like students confidently explaining why MergeSort is stable and QuickSort is fast, but only with careful pivot choices. They should compare algorithms not just by speed but by real-world data conditions, such as whether the input is already sorted. Students will also articulate why binary search requires sorted data, using their own examples from the activities.


Watch Out for These Misconceptions

  • During The Sorting Race, watch for students assuming QuickSort is always fastest because it appeared quick in one trial.

    Have the group rerun their QuickSort on already-sorted data and adjust the pivot selection strategy to show how performance degrades without intervention.

  • During the Gallery Walk, listen for students claiming binary search works on any list.

    Hand them a shuffled deck of cards and ask them to perform binary search; when they fail, prompt them to explain why sorting is a prerequisite.


Methods used in this brief