Skip to content
Computer Science · 10th Grade

Active learning ideas

Recursive Algorithms

Recursion challenges students to hold multiple function calls in their minds at once, a skill that improves their debugging and design thinking. Active learning makes this abstract idea concrete through physical movement, peer discussion, and hands-on tracing that reduces cognitive load.

Common Core State StandardsCSTA: 3A-AP-17
20–35 minPairs → Whole Class4 activities

Activity 01

Role Play25 min · Whole Class

Role Play: Human Call Stack

Assign one student per recursive call for a small example like factorial of 4. Each student is one stack frame: they receive a value, write it down, call the next student forward, wait for a return value, compute their result, and report back. The class watches the call stack build and unwind physically, making the base case and unwinding behavior concrete.

Explain the base case and recursive step in a recursive function.

Facilitation TipDuring the Human Call Stack, have students physically stand up as they call the function and sit down only when they hit the base case so the unwinding is visible to the whole room.

What to look forPresent students with a pseudocode snippet of a recursive function. Ask them to identify the base case and the recursive step, and write one sentence explaining how the input changes in the recursive step.

ApplyAnalyzeEvaluateSocial AwarenessSelf-Awareness
Generate Complete Lesson

Activity 02

Think-Pair-Share20 min · Pairs

Think-Pair-Share: Iterative vs. Recursive

Present two implementations of the same function (summing 1 to n): one iterative, one recursive. Students individually analyze which they find clearer and what trade-offs each approach has. Pairs discuss, then share one advantage and one disadvantage of each. Sets up the stack overflow discussion and builds the analytical habit of comparing implementation strategies.

Compare iterative and recursive solutions for problems like factorial calculation.

Facilitation TipFor the Think-Pair-Share, give pairs one iterative and one recursive solution to the same problem so they must compare mechanics, not just abstract ideas.

What to look forPose the question: 'When might a recursive solution be preferred over an iterative one, and vice versa?' Guide students to discuss trade-offs like code readability, potential for stack overflow, and performance.

UnderstandApplyAnalyzeSelf-AwarenessRelationship Skills
Generate Complete Lesson

Activity 03

Inquiry Circle35 min · Small Groups

Inquiry Circle: Trace the Stack

Groups of 3 receive a recursive function and a specific input. Each group member traces one level of the call stack, writing what value is passed in, what the recursive call returns, and what the final return value is. Groups assemble the full trace and verify it matches running the function, building confidence in reading recursive code.

Analyze the potential for stack overflow errors in recursive algorithms.

Facilitation TipWhile students Trace the Stack, circulate with sticky notes and label each frame with the input and the return value to make the process visible.

What to look forGive students a simple problem, like calculating powers (e.g., 2^n). Ask them to write a recursive function to solve it, ensuring they include both a base case and a recursive step. They should also state the expected output for a small input, like 2^3.

AnalyzeEvaluateCreateSelf-ManagementSelf-Awareness
Generate Complete Lesson

Activity 04

Problem-Based Learning30 min · Small Groups

Debugging Challenge: Missing Base Case

Provide two recursive functions: one correct, one missing a base case. Students run both (or trace by hand) and observe the behavioral difference. Groups document what happens to the call stack in each case and rewrite the broken function with a correct base case, connecting the concept directly to a real implementation failure.

Explain the base case and recursive step in a recursive function.

Facilitation TipHand out colored markers during the Missing Base Case challenge so students can highlight the missing clause before rewriting the function.

What to look forPresent students with a pseudocode snippet of a recursive function. Ask them to identify the base case and the recursive step, and write one sentence explaining how the input changes in the recursive step.

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills
Generate Complete Lesson

A few notes on teaching this unit

Start with the physical role-play to anchor the concept in body memory before moving to code. Use pair comparisons between iterative and recursive solutions to highlight mechanical differences, not just similarities. Avoid comparing recursion only to loops; instead, focus on state management through the call stack so students see recursion as a distinct paradigm.

Students will describe how the call stack grows and shrinks, explain the role of the base case, and decide when to use recursion over iteration. By the end, they should be able to write a simple recursive function and justify its design choices.


Watch Out for These Misconceptions

  • During the Human Call Stack activity, watch for students who say recursive functions always run forever because they keep calling themselves.

    Use the physical demonstration to show how each student sits down when they reach the base case, proving the stack unwinds and the function terminates reliably.

  • During the Think-Pair-Share activity, watch for students who claim recursion is just a loop written differently and that the two are always equivalent.

    Point to the two different implementations they compared and ask them to trace one step of each; highlight how the call stack stores state in recursion but variables do in iteration.


Methods used in this brief