ACM summarized six

The title is currently doing enough, is very superficial understanding of the DP is very one-sided, dynamic transfer equations to find super difficult to understand, these days learn several previous blog in conjunction with their problems do experience summarize here.

The core greedy algorithm is the fastest approach to determine a good goal after collation, DP core is small target to determine the larger goal, and so the conclusion that the ultimate goal.

DP's core idea
why the DP will be faster? 
Either DP or violence, our algorithms are possible within the solution space, find the optimal solution.  
Look banknote issue. Violence approach is to enumerate all possible solutions, this is the most likely solution space.

DP is an enumeration promise as a solution answers. This space is much smaller than violence.  
DP process are summarized  
in a word: major issues to minor ones down.  
Will be a big problem into several small problems;  
solutions of small problem solving;  
the introduction of solution big problem.

DP algorithm design  
step of comparing common design DP algorithm described below.  
First, we are faced with a situation expressed as x. This step is called the design state.  
For the state x, remember we asked the answer (eg minimum cost) is f (x). Our goal is to find f (T). Find f (x) with which the situation concerning (denoted by p) (is to find so there is a possibility of state to find out the optimal state), write a formula (called the state transition equation) to launch f (x) by f§.
DP three step  
who am I? - the design state, represents the situation  
where I came from?  
I want to go? - Design of transition  
design condition is the foundation of DP. The next transfer of design, there are two ways: one is to consider where I came from; the other is to consider me where to go (or reverse thrust is pushing the process), then find f (x) which is common in, Some come from updating the solution x. This is also a lot of DP, we will encounter later.  
All in all, "I come," and "I want to go," one only needs to think clearly, will be able to design a state transition equation to write code to solve the problem. The former, also known as pull-type transfer, the latter also known as metastasis push type.

Guess you like

Origin blog.csdn.net/qq_43515378/article/details/88920584