Apr 13: CodingBat Recursion
Learning Objectives
After today’s class, you should be able to:
- Describe the steps of recursive problem-solving.
- Solve recursive problems using a helper method.
- Implement several recursive methods in Java.
Lesson Outline
Exam Review [15 min]
- Walk through the sample questions
Mini Lecture [10 min]
Recursion: A technique where a method calls itself.
How to write a recursive function:
- Step 0. Define a helper method (if applicable)
- Step 1. Base case: how will the recursion stop?
- Step 2. Current case: what needs to be computed?
- Step 3. Recursion: how will the arguments change?
Code Writing [25 min]