Base Case and Recursive Case
The recursive case shrinks the problem and the base case stops it. Without a base case the stack overflows.
The Call Stack: No base case, stack overflow
countDown(2) prints 2 and calls countDown(1). Depth 2.
Cost
- Space
- O(depth)
Before this
Related
Taught by the same lesson
The Call Stack covers these too, in the same run.