Essential cookies keep your basket and sign-in working. Optional cookies help us understand visits and measure ads. Privacy details.
Method for solving complex problems by breaking them down into simpler overlapping subproblems.
AI-assisted explanation. It may contain errors; use a textbook or original source to check important details.
Dynamic programming (DP) isn’t a single equation so much as a powerful way of thinking for problems that feel too big to tackle head-on. The core idea is this: many hard problems secretly contain the same smaller problems repeated over and over. Instead of re-solving those subproblems each time (wasting effort), DP solves each subproblem once, stores the answer, and reuses it. A good everyday analogy is planning a road trip with many possible routes. If you keep asking, “What’s the fastest way from city X to the destination?” for many different starting cities, you don’t want to recompute the whole trip every time—you want a reliable note (a stored answer) for each city. DP is that note-taking strategy, applied systematically. Conceptually, DP usually has two key ingredients: 1) Optimal substructure: the best solution to the whole problem can be built from best solutions to smaller pieces. 2) Overlapping subproblems: those smaller pieces show up repeatedly. In symbol form, DP often appears as a recurrence (a rule that defines a big answer in terms of smaller answers), for example: - **F(n) = F(n) + F(n) (Fibonacci, the “hello world” of DP) or more generally: - dp[state] = min/max over choices (cost(choice) + dp[nextState]) Here, the characters in the story are: - state: a snapshot of “where you are” in the problem (like a city, or how many items you’ve considered, or how much budget you’ve used) - choice: an action you can take from that state - dp[...]**: the stored best answer for that state DP feels like unlocking a secret because it turns exponential chaos into manageable computation by recognizing repetition and exploiting it elegantly.
Dynamic programming was developed in the 1950s, during an era when governments and industry were suddenly facing large, complex optimization problems—planning, logistics, control systems, and resource allocation—often tied to aerospace and defense. The key challenge was: how do you make optimal decisions in systems that evolve step by step (over time or stages), where brute force would be impossibly expensive? Richard Bellman introduced dynamic programming as a general framework to handle these multi-stage decision problems. One of the central gems in this story is Bellman’s Principle of Optimality: if a path is optimal, then every suffix of that path must also be optimal. That principle is what justifies building a global solution from locally optimal subsolutions stored and reused. A famous historical note: Bellman reportedly chose the term “dynamic programming” partly because it sounded impressive and was politically palatable for funding discussions—“programming” meaning planning/optimization, not writing code in the modern sense. The name stuck, and the method became foundational across computer science, operations research, economics, and AI.
Pioneered by: Richard Bellman (1950s). Key associated concept: Bellman’s Principle of Optimality.