Nepedia
Back to Discover
Independent Reader
💻

Dynamic programming

technology Maturity 9-11 Next article →

Sometimes a big problem is too hard to solve at once.

Shortest path optimal substructure
Shortest path optimal substructure

Richard Bellman created a smart way to fix this. He called it dynamic programming. This method breaks a big job into smaller parts. These parts are called sub-problems.

To use this way, a problem needs two things. First, it needs optimal substructure. This means the best answer to the big problem comes from the best answers to the small parts.

Shortest path optimal substructure
Shortest path optimal substructure

Second, it needs overlapping sub-problems. This happens when you see the same small job many times. Instead of doing the same work twice, you save the answer. We call this memoization. It is like writing an answer in a notebook so you can look it up later.

There are two ways to do this. A top-down way starts with the big goal. It breaks it down and saves the small answers. A bottom-up way starts with the smallest parts first. It builds them up to solve the big goal.

Fibonacci dynamic programming
Fibonacci dynamic programming

People use this in many fields. It helps in economics to plan saving. It helps in science to study tiny parts of life. It even helps computers find the shortest path on a map.

198 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (4)
File:Shortest path optimal substructure.svg
Shortest path optimal substructure.svg
File:Fibonacci dynamic programming.svg
Fibonacci dynamic programming.svg
File:Tower of Hanoi.jpeg
Tower of Hanoi.jpeg
File:Tower of Hanoi 4.gif
Tower of Hanoi 4.gif
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.