next up previous
Next: Up: Previous:

Example

Not all divide-and-conquer problems exhibit optimal substructure.

Consider the problem of visiting all vertices of a graph in a simple cycle, starting from a chosen vertex. The problem is to find the cycle that yields the smallest total edge cost. We will break our problem down by finding the last vertex to visit in our tour. The subproblem is then to find the optimal arrangement of vertices to visit before the chosen last vertex.

Consider this example. The optimal tour is \(A \rightarrow B \rightarrow C \rightarrow D \rightarrow A\), but when the last vertex D is removed, the optimal tour for the subproblem is \(A \rightarrow C \rightarrow B \rightarrow A\), which is not part of the globally optimal solution.



\psfig{figure=figures/f9-7.ps}


next up previous
Next: Up: Previous: