Neural Ninjas Β· DSA Simulation Labs Β· Lab 40

πŸ—„οΈ The Fibonacci Cache

Naive recursion recomputes the same fib(k) over and over across the tree. The instant a repeat is spotted, that whole branch turns transparent and redirects to one shared Cache Box instead β€” no re-expansion, no wasted work.

Call Log

Controls

🌳 Recursion TreeI branch into fib(k-1) and fib(k-2) every single time β€” unless the cache already has the answer. Then I don't branch at all.
πŸ—„οΈ Cache BoxOnce I hold fib(k), I hold it forever during this run. Every future call asking for that exact k gets redirected straight to me β€” instantly.
Pick a level above to begin.