Dynamic Programming
Solve each overlapping subproblem once and reuse the answer.
Decision · step 2 of 24Recursion Trees: fib(6) with memoization
fib(6) is not a base case and not cached, so it calls fib(5) first and fib(4) after that.
What you will see
A recursion tree collapsing into a table.
Cost
| Space | O(states) |
|---|
How you work with it here
play it through, step one change at a time, compare two runs.
Screen readers: Each paradigm lesson is narrated as the characteristic loop it performs; the comparison view is available as a table.
Reduced motion: Side-by-side panes update in place.
Before this
Taught by the same lesson
Recursion Trees covers these too, in the same run.