Data Structures & AlgorithmsVery hardGATE CS · Codeforces Div2 C

A tree has these parent→child edges: 83→70, 86→49, 10→12, 10→67, 60→86, 86→10, 31→65, 10→76, 67→31, 65→7, 67→47, 70→60, 86→17. A vertex cover is a set of vertices such that every edge has at least one endpoint in the set. What is the size of a minimum vertex cover?

  1. A. 6
  2. B. 8
  3. C. 7
  4. D. 5

Correct answer: D. 5

In a tree the minimum vertex cover equals the maximum matching (König's theorem), found greedily from the leaves up. Counting leaves or internal nodes is a common misreading, not the optimum.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic