Data Structures & AlgorithmsVery hardCodeforces Div 2 D · ICPC regional

A tree has the vertices D, G, I, J, M, T, X, Y and the edges Y–I, I–J, J–G, J–X, G–T, X–M, Y–D. 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. 4
  2. B. 3
  3. C. 2
  4. D. 5

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 (3) is only a lower-bound heuristic.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic