Recursion
A function that calls itself on a smaller input until a base case, each call parked as a frame until the one above it returns.
The Call Stack: Summing a list recursively
The list starts with 3. Keep it, and call sum on the remaining 4 numbers. A smaller problem each time.
Cost
- Space
- O(depth)
Before this
Leads to
Topics that need this one first.
Taught by the same lesson
The Call Stack covers these too, in the same run.