The basic elements of dynamic programming

Dynamic planning requirements : the overlapping nature of the structural properties of a sub-optimal subproblems 2 -----> basic elements of the dynamic programming algorithm can be used to solve the problem of

1 optimal substructure

When the optimal solution contains optimal solution to the problem of his son, said the problem has structural sub-optimal. Nature provides optimal substructure of the problem of dynamic programming algorithm can be used to solve the important clues.

Dynamic programming, the optimal utilization properties substructure, to a bottom-up optimum phase throughout constructed from the sub-optimal solution of the problem of recursive manner.

2 overlapping sub-problems

When dynamic programming, to avoid the recursive, repeating the same sub-problem calculation process, the solution for each sub-problem only once, and will save it in a table when needed again, simply to see what the results with constant time .

3 of the memorandum method

Recursively top-down

First, check the corresponding entries, if there is a direct return. If not, then save it again later to continue viewing.

Reproduced in: https: //my.oschina.net/u/204616/blog/545138

Guess you like

Origin blog.csdn.net/weixin_34254823/article/details/91989741