Data Structures & AlgorithmsVery hardGATE CS · Codeforces Div2 C

A tree has these parent→child edges: 59→18, 19→47, 16→98, 88→59, 47→91, 96→16, 3→13, 3→88, 98→7, 3→96, 18→92, 13→19. 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. 3
  2. B. 10
  3. C. 6
  4. D. 7

Correct answer: C. 6

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