AI engineering glossary · Data structures algorithms

What is DP (dynamic programming)?

Dynamic programming (also called DP): A method for solving problems by breaking them into overlapping subproblems, solving each only once and storing the answers for reuse. It applies when an optimal solution is built from optimal solutions of smaller pieces.

Level: intermediateTopic: Data structures algorithms

Dynamic programming: an example

Computing the 40th Fibonacci number by storing each earlier value takes 40 steps, while naive recursion repeats work over a hundred million times.

Related terms

More Data structures algorithms terms

Where you learn it

Dynamic programming is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.