Dynamic Programming DP [continuously updated]

Dynamic Programming

  Dynamic Programming (English: Dynamic programming, referred to as DP) is a kind of mathematics, management science, computer science, economics and bioinformatics for use in solving complex problems through the original problem into sub-problems of a relatively simple way method.
  Dynamic programming is often suitable for overlapping sub-problems and optimal substructure nature of the problem, dynamic programming method is often far less than the time spent simple solution.
  The basic idea behind dynamic programming is very simple. In general, the solution to a given problem, we need to understand its different parts (ie sub-problems), then according to the solution of a problem child to arrive at the solution of the original problem.
  Usually very similar in many sub-problems, for only trying to solve the problem once for each child dynamic programming method, thereby reducing the amount of calculation: Once a solution to the problem of the stator has been calculated, it is memory storage, so next time you need the same sub-problems when the solution of the direct look-up table. In this approach the number of repeats questions about the size of the input was particularly useful when exponential growth.


Dynamic programming problem satisfies three important properties

Optimal substructure property: If the solution of the problem of sub-optimal solution to the problem is also included in the best, we say that the problem has structural sub-optimal (ie, meet the optimization principle). Sub-optimal structural properties of problem-solving dynamic programming algorithm provides an important clue.

Nature overlapping subproblems: overlap problem refers to proton not always new problems subproblems recursive algorithm with respect to a top-down problem solving, generated each time that some sub-problem will be repeated a plurality of times calculated. Dynamic programming algorithm is the use of the overlapping nature of this sub-problems, the calculation of each sub-problem only once, and then save the results in a table, when you need to calculate the sub-problem has been calculated again, just in a table simply look at the results, so as to obtain higher efficiency.

No after-effect: after the various stages lined up according to a certain order, for a given stage of a state, its previous status of each stage can not directly influence its future decisions, but only through this current state. In other words, each state is a complete summary of past history. This is no after-directional, also known as no after-effect.


DP & simple recursive


01 backpack

[01] Detailed backpack: https://blog.csdn.net/Q_1849805767/article/details/103230949


Full backpack

[Completely] Detailed backpack: https://blog.csdn.net/Q_1849805767/article/details/103231110


Multiple backpack


Packet backpack


Tree Backpack


LIS


LCS


DP range


DP tree


Shaped pressure DP

Published 104 original articles · won praise 60 · views 5841

Guess you like

Origin blog.csdn.net/Q_1849805767/article/details/103230523