Dymanic programming
Local vs Global consideration
We are able to make local observations and choices, but it is hard to see the global consequences.
Sometimes a local initial sacrifice can globally lead to a better overall solution.
recursive backtracking always has the basic structure as 8-queen problem
Optimal substructure
optimal substructure means :
every optimal solution to a problem contains optimal solutions to subproblems
same as brute force algorithm, but there may be an exponential numbers of paths.
how would you iterate through all paths?
sometimes we can exploit the structure to speed up the algorithm.
a greedy algorithm prunes off all branches except the one that looks best.
memoization
remember the solutions for the sub-instances so that if ever it needs to be solved again, the answer can be used.
exponential redoing work...waste time
The dynamic programming reverses the recursive backtracking algorithm, one is up-down, and one is down-up.