Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 41s1 days 16 hours 1 minutes 41 seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 41s1 days 16 hours 1 minutes 41 seconds.

Sign in to watch this lesson
Algorithms - Dynamic Programming · 5:23
Dynamic programming means never redoing work: the naive Fibonacci tree for f(29) makes 1,664,079 calls, while the same recursion with a memo pad makes 57 (about 29,000 times fewer). We collapse the call tree into a thin DAG (top-down memoization), flip it into a loop over an array (bottom-up tabulation), shrink the array to a 3-slot ring buffer, and watch f(47) overflow a 32-bit int. Then the recipe every later DP lesson follows (state, transition, base cases, order, answer, memory), the cost of array vs hash-map tables measured on this Mac, and the die-reroll interview question solved by backward induction, the Bellman equation in miniature.