DSA · Reimagined
Recursion & DP medium time O(2ⁿ) space O(n)

Recursion — Fibonacci Call Tree

Plain recursive Fibonacci calls itself twice per node, so the call tree branches exponentially. Identical subtrees appear over and over — the same f(2) is computed from scratch several times. That repeated work is exactly what memoisation and DP remove.

Compute f(5) by plain recursion — every call spawns two more.

1 / 32
A fixed scene — scrub through it, or open the code.

Practice

Machine twin: /dsa-viz-v2/recursion-fibonacci.json — the full deterministic run as structured data.