Data Structures & AlgorithmsHardCodeforces Div 2 C · GATE CS

A tree has the vertices B, C, D, E, M, P, S, U, V, W and the edges U–B, U–C, C–W, B–V, U–M, M–D, D–P, B–S, W–E. A set D dominates the tree if every vertex is in D or adjacent to a vertex in D. What is the size of a smallest dominating set?

  1. A. 2
  2. B. 3
  3. C. 5
  4. D. 4

Correct answer: B. 3

A tree DP over three states per vertex gives 3. A vertex cover (4) is a different quantity, and the leaf count (4) is only a lower-bound heuristic.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic