Data Structures & AlgorithmsVery hardProduct-company placement

A tree on vertices 1–10 has edges 2–1, 3–1, 4–2, 5–2, 6–4, 7–6, 8–3, 9–7, 10–8. What is the size of a minimum DOMINATING set (every vertex is in the set or adjacent to one in it)?

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

Correct answer: C. 3

Greedy from the leaves up: a leaf's parent must be chosen (or the leaf dominated otherwise), then remove what it dominates and repeat; this gives 3. A minimum vertex cover (size 5) is a different problem.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic