Book contents
- Frontmatter
- Contents
- Preface
- Introduction
- Part One Iterative Algorithms and Loop Invariants
- Part Two Recursion
- Part Three Optimization Problems
- 13 Definition of Optimization Problems
- 14 Graph Search Algorithms
- 15 Network Flows and Linear Programming
- 16 Greedy Algorithms
- 17 Recursive Backtracking
- 18 Dynamic Programming Algorithms
- 19 Examples of Dynamic Programs
- 20 Reductions and NP-Completeness
- 21 Randomized Algorithms
- Part Four Appendix
- Part five Exercise Solutions
- Index
18 - Dynamic Programming Algorithms
Published online by Cambridge University Press: 05 June 2012
- Frontmatter
- Contents
- Preface
- Introduction
- Part One Iterative Algorithms and Loop Invariants
- Part Two Recursion
- Part Three Optimization Problems
- 13 Definition of Optimization Problems
- 14 Graph Search Algorithms
- 15 Network Flows and Linear Programming
- 16 Greedy Algorithms
- 17 Recursive Backtracking
- 18 Dynamic Programming Algorithms
- 19 Examples of Dynamic Programs
- 20 Reductions and NP-Completeness
- 21 Randomized Algorithms
- Part Four Appendix
- Part five Exercise Solutions
- Index
Summary
Dynamic programming is another powerful tool for solving optimization problems. Just like recursive backtracking, it has as a key component a recurrence relation that says how to find an optimal solution for one instance of the problem from optimal solutions for some number of smaller instances of the same problem. Instead of re-cursing on these subinstances, dynamic programming iteratively fills in a table with an optimal solution for each, so that each only needs to be solved once. Dynamic programming provides polynomial-time algorithms for many important and practical problem.
Personally, I do not like the name “dynamic programming.” It is true that dynamic programming algorithms have a program of subinstances to solve. But these subinstances are chosen in a fixed prescheduled order, not dynamically. In contrast, in recursive backtracking algorithms, the subinstances are constructed dynamically.
One way to design a dynamic programming algorithm is to start by guessing the set of subinstances that need to be solved. However, I feel that it is easier to start by designing the recurrence relation, and the easiest way to do this is to first design a recursive backtracking algorithm for the problem. Once you have done this, you can use a technique referred to as memoization to mechanically convert this recursive backtracking algorithm into a dynamic programming algorithm.
Start by Developing a Recursive Backtracking
This section reviews the recommended steps for developing a recursive backtracking algorithm.
- Type
- Chapter
- Information
- How to Think About Algorithms , pp. 267 - 294Publisher: Cambridge University PressPrint publication year: 2008