Skip to content
Computer Science · Grade 10

Active learning ideas

Algorithmic Efficiency: Time Complexity

Active learning works for time complexity because students need to see algorithms in motion to grasp how run time scales with input size. When they measure and compare real timings or operation counts, abstract concepts become concrete, making growth rates visible and memorable.

Ontario Curriculum ExpectationsCS.HS.A.3CS.HS.A.4
20–45 minPairs → Whole Class4 activities

Activity 01

Problem-Based Learning45 min · Pairs

Pairs: Search Algorithm Timing

Pairs write pseudocode or simple Python for linear and binary search. They test both on lists of 20, 100, and 500 items, recording execution times. Pairs graph results and present one insight on efficiency differences.

Compare the efficiency of two different algorithms designed to solve the same problem.

Facilitation TipDuring the Search Algorithm Timing activity, circulate with a stopwatch and have pairs verbalize what they are timing and why this step matters for growth rate analysis.

What to look forPresent students with two simple code snippets that solve the same problem (e.g., finding the largest number in a list using a loop vs. a built-in function). Ask them to identify which snippet is likely more efficient and explain why, referencing the number of operations performed for a given input size.

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills
Generate Complete Lesson

Activity 02

Problem-Based Learning35 min · Small Groups

Small Groups: Loop Nesting Challenge

Groups analyze nested loops versus single loops for tasks like matrix traversal. They predict operation counts for inputs n=10, 50, 100, then simulate with counters or code. Groups compare predictions to actual counts in a shared class chart.

Evaluate how input size impacts an algorithm's execution time.

Facilitation TipIn the Loop Nesting Challenge, ask groups to circle dominant loops in their code and write next to them how many times each operation runs relative to input size.

What to look forPose the question: 'Imagine you are designing an app to recommend movies to users based on their viewing history. How would the size of your user database (input size) affect your choice of algorithm for making recommendations, and why is time complexity important in this scenario?'

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills
Generate Complete Lesson

Activity 03

Problem-Based Learning30 min · Whole Class

Whole Class: Prediction and Test Demo

Display two sorting algorithms on screen. Class predicts which finishes first for large arrays, then runs live timings. Follow with vote and discussion on why results match or surprise predictions.

Predict the performance of an algorithm given a specific data set.

Facilitation TipFor the Prediction and Test Demo, prepare a data projector to show real-time run times so the whole class sees the difference between O(n) and O(n^2) play out.

What to look forProvide students with a small, unsorted list of numbers and a sorted list of numbers. Ask them to: 1. Estimate how many comparisons a linear search would take for the unsorted list. 2. Estimate how many comparisons a binary search would take for the sorted list. 3. Briefly explain the difference in their estimates.

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills
Generate Complete Lesson

Activity 04

Problem-Based Learning20 min · Individual

Individual: Efficiency Journal

Students select a problem like finding duplicates in a list, sketch two algorithms, and estimate time complexity using Big O basics. They test small cases manually and note input size effects in a personal log.

Compare the efficiency of two different algorithms designed to solve the same problem.

What to look forPresent students with two simple code snippets that solve the same problem (e.g., finding the largest number in a list using a loop vs. a built-in function). Ask them to identify which snippet is likely more efficient and explain why, referencing the number of operations performed for a given input size.

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills
Generate Complete Lesson

A few notes on teaching this unit

Teachers should start with small datasets so students can count operations by hand before moving to code or timing tools. Avoid diving straight into big-O notation; instead, let students experience the pain of slow growth in loops through concrete examples. Research shows that plotting run times on graph paper or using spreadsheets helps students connect data to symbols.

Successful learning looks like students explaining why a binary search on a sorted list outperforms a linear search as input size grows. They should connect O(n) and O(log n) notation to actual operation counts or timing graphs, and justify algorithm choices based on efficiency rather than code length.


Watch Out for These Misconceptions

  • During the Search Algorithm Timing activity, watch for students assuming all correct algorithms run equally fast on large inputs.

    Have pairs plot the timing data on a graph and observe how the quadratic algorithm’s curve steeper than the linear one as input size increases, prompting a class discussion on growth rates.

  • During the Loop Nesting Challenge, watch for students equating code length with speed.

    Ask groups to circle the nested loops and count how many times the inner operation runs for a given input size, shifting focus from total lines to dominant runtime behavior.

  • During the Prediction and Test Demo, watch for students dismissing time complexity on modern hardware.

    Run the demo with large datasets so run times balloon visibly, then ask students to reflect on why efficiency still matters even with fast computers.


Methods used in this brief