liveBook · Manning

Dynamic programming

As explained in Advanced Algorithms and Data Structures

Dynamic programming is an algorithmic technique that solves overlapping subproblems once, stores their results, and combines them to solve the original problem.

Dynamic programming solves complex problems by decomposing them into recursive subproblems, solving each subproblem once, storing its result, and combining those results into the final solution. section 1.3.3

The technique is especially useful when:

  • Subproblems recur during the computation, making repeated solution work avoidable through stored results. section 1.3.3
  • A difficult optimization problem can be replaced by a pseudo-polynomial algorithm whose running time depends on an input value such as capacity. section 1.3.3
  • Requirements and constraints can be examined before committing to an algorithm, since relaxing a constraint may produce a cheaper solution. section 1.3.5

0-1 knapsack

For a crate with capacity 1000 kg and 62 items, dynamic programming considers capacity values and items, taking about 1000 × 62 steps instead of exploring roughly 2^62 combinations. This is practical because the bounded capacity makes the pseudo-polynomial approach fast. section 1.3.3

How Advanced Algorithms and Data Structures covers it

How deep it goes
Defines the recursive decomposition and storage strategy but stops short of implementation details.
Examples
Uses a 1000-kilogram crate and 62 candidate items to contrast dynamic programming with exhaustive combination search.
What you can do after
Evaluate when repeated subproblems justify stored solutions and when capacity-dependent performance is acceptable.
How it connects
Connects dynamic programming with 0-1 knapsack, pseudo-polynomial algorithms, NP-complete problems, and algorithm selection.

Also explained in

Compare how 5 books explain dynamic programming →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Advanced Algorithms and Data Structures. The section links point to the parts of the book it draws on.