Algorithm recorded

A dynamic programming algorithm
dynamic programming algorithm is by splitting the problem, the definition of the relationship between state and state, so that the problem can be recursive (or partition) way to solve.
Problems to be solved into several sub-problems (stage), in order to solve the sub-stage, preceding sub-problem solutions, it provides useful information for solving the problem of a child.
Since dynamic programming to solve the problem of overlapping sub-problems most of this feature, in order to reduce double counting, for each sub-problem solution only once, to different states at different stages of preservation in a two-dimensional array.

Dynamic programming problems in general should have three properties:
(1) the principle of optimization: If the solution sub-optimal solutions of the problem is also included in the best, they said the problem with optimal substructure that meet principle of optimality.
(2) no after-effect: that a phase state is established, this will not affect future state decisions. In other words, the future status process does not affect a previous state, only with the current status.
(3) overlapping subproblems: namely between the sub-problems are not independent, a decision sub-problems at the next stage may be used multiple times to. (This property is not dynamic programming necessary conditions apply, but if this is not the nature of dynamic programming algorithm does not have the advantage compared with other algorithms)

The most important thing is to determine the dynamic programming three elements:
phase (1) problem
(2) the status of each stage
(3) was transformed into a stage after a recurrence relation between the front stage

Published 45 original articles · won praise 9 · views 30000 +

Guess you like

Origin blog.csdn.net/zhanglinlove/article/details/90733651