• When solving problems by division, the number of sub-problems is often the exponential function of the problem size, so the time consumption is too large. • The idea of dynamic planning is that if each sub-problem is not independent, the number of sub-problems is only polynomial magnitude, and we can save the answers to the sub-problems that have been solved, and then find the answers when needed, so that a large number of repeated calculations can be avoided.
The basic idea is to use a table to record the answers to all the resolved sub-problems, whether or not the problem is used later, and if it is calculated, fill in the table with the results.
Netherfield argues//haha
intFintNintA[n]) { if(n==0)return 0; if(n==1)return 1; A1=a[n-1]; A2=a[n-2]; if.... //using A1 and A2 instead of already calculated results, you can avoid a certain degree of recursion to reduce computational time and computational space returnF (n1, a) +f (N-2, a);}
Dynamic planning vs. divide-and-conquer strategy