Data Structures & AlgorithmsHardCodeforces Div 2 D · ICPC regional

A tree has the vertices A, E, H, P, R, S, T, U, W, Y and the edges H–T, T–E, T–A, E–P, T–Y, A–R, Y–S, R–U, U–W. 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. 6
  4. D. 5

Correct answer: A. 4

A tree DP over three states per vertex gives 4. A vertex cover (5) 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