Data Structures & AlgorithmsHardGATE CS · Codeforces Div 2 B

A tree has the vertices A, G, H, I, L, O, P, T, U, Z and the edges G–T, G–U, U–H, H–O, O–Z, Z–P, P–A, A–I, P–L. 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 (3) is only a lower-bound heuristic.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic