Memoization — Concepts
Memoization
fibonacci with memoization
f(0)
—
f(1)
—
f(2)
—
f(3)
—
f(4)
—
f(5)
—
f(6)
—
f(7)
—
● computing● cached● cache hit
Step 1:Computing fib(7) with memoization. The table stores results. Without memo: 41 calls. With memo: just 8!