Data Structures & AlgorithmsModerateGATE CS · ICPC regional

A tree has the vertices C, F, G, I, N, R, S and the edges R–G, R–S, S–I, I–C, C–F, R–N. 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. 4
  3. C. 1
  4. D. 3

Correct answer: A. 2

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