What is recursion
- Reusing a function
- Calling itself
- Similar to a loop
- But not linear, instead it could be exponential
Why recursion
What is the advantage over loops?
- Divide-and-conquer type problems
- Tree search
- Sorting
- etc.
Classic example: factorial