Demystifying Dynamic Programming

Justyna Kuchta
The Startup
Published in
5 min readJul 13, 2020

--

with JavaScript examples

Photo by chuttersnap on Unsplash

It is notoriously hard to learn and is a huge topic that many books have been written about dynamic programming algorithms. We are here to cover the basics. In order to understand dynamic programming, you have to be comfortable with recursion. If you need a refresher, you are in luck, I recently wrote about my own adventures with recursion and memoization — JavaScript Recursion and Memoization for Dummies.

So what is dynamic programming?

In a nutshell, it’s a method of solving a complex problem by breaking it down into a collection of smaller subproblems, solving them just once, and storing their solution.

You might be thinking, wait, isn’t that just recursion with memoization? Well, yes and no. Some might say that dynamic programming and recursion with memoization are one and the same but it is not technically correct.

Dynamic programming is a broader term — an approach to solve some problems, a small subset, but those we can apply this approach to can speed up the code dramatically.

Where does the name come from?

The term can be misleading and could probably benefit from a new name, any ideas? It sounds like maybe it does different things, dynamically, but the term was actually coined in the 1940s by Richard…

--

--

Justyna Kuchta
The Startup

Web Developer based in Atlanta, GA. Book worm, cat lover, language geek. Open to new opportunities https://www.linkedin.com/in/justyna-kuchta-ab7b3b16/