Data Structures & AlgorithmsVery hardGATE CS · Codeforces Div2 C

A tree has these parent→child edges: 72→38, 2→14, 2→86, 2→52, 19→72, 86→91, 38→68, 2→28, 56→2, 72→90, 86→70, 2→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. 7
  2. B. 4
  3. C. 6
  4. D. 5

Correct answer: B. 4

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