AlgoScope

Memoization

TechniqueintermediateDP Foundations

Top-down recursion that caches each result; the recursion tree collapses to one expansion per state.

Decision · step 2 of 24Recursion Trees: fib(6) with memoization
f(6)call

fib(6) is not a base case and not cached, so it calls fib(5) first and fib(4) after that.

Open in the player →or start at step 2

What you will see

The recursion tree with cache hits short-circuiting whole subtrees.

How recursion trees works →

Cost

SpaceO(states)

How you work with it here

play it through, step one change at a time, scrub to any step, run it on your own input, predict what happens next.

Screen readers: Table cells announce their state and value; each step announces which cells were read and the value written.

Reduced motion: Dependency arrows appear statically and the cell value crossfades.

Related

Leads to

Topics that need this one first.