Apr 25: Tracing Recursion
Learning Objectives
After today's class, you should be able to:
- Explain how a return statement works in a recursive function.
- Describe the process of tracing a recursive function on paper.
- Write a recursive method that returns results via a parameter.
Reminders¶
- By Friday 11pm: Do the Week 14 reading and take Quiz11
- By Friday 11pm: Finish and submit Lab 11 (on CodingBat)
- By Monday 11pm: Submit HW 9 Part B (last 3 methods)
Lesson Outline¶
Tracing [40 min]
- Slides: 3 Examples
- Handout: 6 Exercises
- RecursionTracing.java – try running with a debugger
Writing [25 min]
- Lab 11: CodingBat Recursion
- Submit problems 1–7 via CodingBat (remember to log in!)
HW9 Hints [10 min]
totalPointDiff(elim)
– recursive traversal, starting withgetFinalMatchup
buildSchedule(elim)
– recursive traversal with aMap
parameter for resultscalculateRecords(t)
– use aSet
to keep track of the Matchups you've seen