and overlapping subproblems
optimal substructure means that the substructure
subproblems can be used to find the optimal solution to the problem
complete.
For example, the shortest path to a goal from a corner in an acyclic graph can be found by first calculating the nearest road to the goal from all adjacent vertices
then using this to find the best complete path.
Figure 1.
Finding the nearest road in a graph using optimal substructure
, the dark lines show the way close from the beginning to the end. ie one subproblem is used to solve many different problems bigger.
Troubleshooting dynamic programming
0 comments:
Post a Comment