Chapter 13: Recursion
Recursive Helper Methods
- Sometimes it is useful to have a helper method. For
example, checking whether a string is a palindrome.
Efficiency of Recursion
- Recursive solution to computing Fibonacci numbers.
- Iterative solution to computing Fibonacci numbers.
- In general, recursive solutions are easier to code, but are
slightly slower due to the overhead involved in a method call.
- If a recursive solution makes redundant computations, then
iteration can be much better.
Lecture Code