There is a greedy algorithm for finding minimum vertex cover of a tree which uses DFS traversal.
- For each leaf of the tree, select its parent (i.e. its parent is in minimum vertex cover).
- For each internal node:
if any of its children is not selected, then select this node.
How do I prove that this greedy strategy gives an optimal answer? That there is no vertex cover smaller in size than the one that the above algorithm produces?
Then the first step of your algorithm will pick node 5. The second step will then possibly pick the first node (root) and then the second node (child) OR the third node. However, this is incorrect since you only want to pick node 2 and node 5 for a correct solution.
– miguel.martin May 03 '16 at 03:32