04 Try it yourself Interactive

Watch the repeats, then watch them vanish

The first tab draws every call plain recursion makes for climb(n), level by level. A box turns green when a base case answers outright, blue the first time a larger value is worked out, and rose whenever a value this run already settled is asked for again — every rose box drags a whole subtree behind it, and those subtrees are what a cache deletes. The second tab fills the table left to right, lighting the two cells each new value reads from. Nothing moves until you press Next.

Plain recursion
no memory between calls
One whole number from 2 to 6.
Press Next to begin. Each press moves one step.


      
Now at
Calls made0
Answers known0
Repeated work0
step 0 / 0