Recursion
Categories
Two general categories of recursion functions:
repeatedly execute a task
perform a calculation based on a subproblem
Strategy
Approach recursion with a top-down approach. Strategy (from A Common-Sense Guide to Data Structures and Algorithms, Second Edition )
Imagine the function you're writing has already been implemented
Identify the subproblem of the problem
See what happens when you call the function on the subproblem and go from there
Last updated