Fibonacci (Memoized)

Richard Bellman, 1952

O(n)

Dynamic programming was formalized by Richard Bellman in the early 1950s. The Fibonacci sequence is its most intuitive demonstration: naïve recursion recomputes the same subproblems exponentially many times, while memoization caches each result for O(n) total work. The visualization shows the recursive call tree for fib(7), with nodes turning gold as they compute and teal when their value is memoized. Subsequent lookups of cached values appear instantly in teal.