Skip to content
Computer Science · Grade 10

Active learning ideas

Introduction to Recursion

Recursion is abstract, so active learning helps students visualize how each call works. Pair tracing, modeling, and debugging make the stack of calls concrete rather than abstract. When students manipulate examples by hand, they internalize why the base case matters and how memory grows with each call.

Ontario Curriculum ExpectationsCS.HS.A.2CS.HS.P.1
15–30 minPairs → Whole Class4 activities

Activity 01

Flipped Classroom20 min · Pairs

Pair Tracing: Factorial Calls

Pairs receive printed recursive factorial code and trace calls step-by-step on worksheets, noting base cases and stack growth. They compute results manually, then compare to iterative loops. Pairs share one insight with the class.

Differentiate between iterative and recursive approaches to problem-solving.

Facilitation TipDuring Pair Tracing: Factorial Calls, have students write each call on a separate sticky note to build a visible call stack on the desk.

What to look forPresent students with a short, non-working recursive function. Ask them to identify the missing base case or the incorrect recursive step and explain why it prevents the function from working correctly.

UnderstandApplyAnalyzeSelf-ManagementSelf-Awareness
Generate Complete Lesson

Activity 02

Flipped Classroom30 min · Small Groups

Small Groups: Tower of Hanoi Model

Groups use stacked blocks or cups to simulate Tower of Hanoi moves, identifying the base case for one disk and recursive steps for larger towers. They record moves in pseudocode. Groups present their solutions.

Analyze the base case and recursive step in a given recursive function.

Facilitation TipDuring Small Groups: Tower of Hanoi Model, assign roles so one student moves disks while another records the recursive steps aloud.

What to look forProvide students with the code for a recursive factorial function. Ask them to write down the output for factorial(3) and list the sequence of function calls and returns that produce this result, simulating the call stack.

UnderstandApplyAnalyzeSelf-ManagementSelf-Awareness
Generate Complete Lesson

Activity 03

Flipped Classroom25 min · Whole Class

Whole Class: Infinite Loop Hunt

Project buggy recursive code missing a base case. Students use digital polls to vote on fixes, then discuss as a class while you step through execution. Revise code live based on input.

Predict potential issues like infinite recursion and stack overflow.

Facilitation TipDuring Whole Class: Infinite Loop Hunt, run sample code live and pause execution to ask students to predict the next call before revealing it.

What to look forFacilitate a class discussion: 'When might a recursive solution be preferred over an iterative one, even if it's slightly less efficient? Consider problems involving hierarchical structures or mathematical definitions.' Encourage students to provide specific examples.

UnderstandApplyAnalyzeSelf-ManagementSelf-Awareness
Generate Complete Lesson

Activity 04

Flipped Classroom15 min · Individual

Individual: Fibonacci Sketch

Students sketch recursive Fibonacci call trees on paper, marking redundant calls and stack depth. They predict output for small inputs and note overflow risks. Submit for quick peer review.

Differentiate between iterative and recursive approaches to problem-solving.

Facilitation TipDuring Individual: Fibonacci Sketch, provide graph paper so students draw the call tree with branches for each recursive step.

What to look forPresent students with a short, non-working recursive function. Ask them to identify the missing base case or the incorrect recursive step and explain why it prevents the function from working correctly.

UnderstandApplyAnalyzeSelf-ManagementSelf-Awareness
Generate Complete Lesson

A few notes on teaching this unit

Start with the stack analogy: each call is a plate added to a tower. Teach students to read recursive functions from the bottom up, locating the base case first. Avoid rushing into memoization; let students experience the inefficiency of naive recursion firsthand. Research shows that tracing beats lecturing for deep understanding of recursion, so allocate time for deliberate practice with pens, sticky notes, and colored pencils.

Students can trace recursive calls step by step, identify base cases and recursive steps clearly, and explain when recursion becomes inefficient. They justify their reasoning using execution traces and compare recursive and iterative approaches with confidence.


Watch Out for These Misconceptions

  • During Pair Tracing: Factorial Calls, watch for students assuming recursion is always faster.

    Have pairs time their manual execution versus a simple loop, then discuss why repeated subproblem calls in naive recursion slow things down and how memoization changes that.

  • During Small Groups: Tower of Hanoi Model, watch for students thinking the base case is optional.

    Ask groups to remove the base case from their written rules and simulate the infinite stack of moves, then insert a base case to restore a finite sequence.

  • During Individual: Fibonacci Sketch, watch for students believing recursive calls use no extra memory.

    Require students to draw each call as a stack frame on their graph paper, then count frames for Fibonacci(5) to visualize growth and overflow risk.


Methods used in this brief