Data Structures & AlgorithmsVery hardGATE CS · Codeforces Div2 C

A tree has these parent→child edges: 78→70, 51→78, 8→11, 9→37, 37→34, 37→56, 51→9, 56→76, 11→86, 87→93, 70→8, 78→74, 56→87. 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. 5
  3. C. 14
  4. D. 13

Correct answer: A. 7

In a tree, minimum vertex cover = maximum matching (König), found greedily from the leaves: take the parent of every uncovered leaf, giving 7. Counting the leaves gives 5, 14 is every vertex and 13 one vertex per edge.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic