Gregory M. Kapfhammer
Details in the Textbook
Method makes one or more calls to itself
Process stops when a base case is reached
Visualized with a call tree or a program stack
Data structure relies on smaller instances of itself
Any questions about the definitions?
Recursive factorial and recursive GCD
Can you find the recursive call?
Can you find the base case?
How do these programs work?
Incorrect recursion leads to inefficient algorithms
Be careful about how many recursive calls you create!
Details vary depending on JVM implementation
Possible to store about 1000 simultaneous calls
What happens when you exceed the limit?
Be careful to avoid StackOverflow exceptions!