Use a diagram with variable-value pairs for each call of a recursive function to help students see the change of control flow as calls are made and completed.

  • It can be helpful to draw an arrow from one diagram to the next to indicate where a function call was made and that control is being passed. After the call has completed, the arrow can be erased to indicate a return of control.
  • This method can also be applied when teaching Assembly -- have the diagrams represent the different phases of the stack.

More about this tip

External Source

Interview with Nick Melnyk