C++: Dynamic Programming

211 阅读1分钟

From my understanding, the dynamic programming algorithm is an inductively recursive algorithm with memorization of intermediate results that will be consumed later on by algorithm computing to reduce the cost of recomputation of some results.

The problems which are suitable to be solved by dynamic programming have properties:

  1. When the problem size is small enough, it is simple to solve.
  2. A large size problem can be divided into smaller ones iteratively until it is small enough to have property 1.
  3. The results of smaller problems can be combined to facilitate the solution for larger problem, that is reason for intermediate result memorization kicking in.

Because those properties are orthogonal to other programming techniques, therefore dynamic programming can be used with other algorithms together to solve some specific problems. For instance of dynamic-programming based optimal pattern matching selectors.