Search⌘ K

What is Dynamic Programming?

Explore the fundamentals of dynamic programming and understand how storing past results helps optimize recursive algorithms. This lesson explains why dynamic programming is essential for avoiding repeated calculations and introduces its historical background and key concepts to set the stage for advanced techniques.

Chances are you’ve seen the following quote espoused to dynamic programming before:

Those who cannot remember the past are condemned to repeat it

~ George Santayana

Why do we need to remember the past?

Let’s do a small exercise and see what it evaluates too.

x = 2*2*2*2*2*2*2

Now evaluate the following equation.

x = x*2

You had to count all the 2s in the first equation, which took some time. But you were able to evaluate the second one much quicker because you ...