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?
- A. 4
- B. 3
- C. 6
- 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.
Practise more Trees, Graphs, Recursion and Dynamic Programming questionsTrees, Graphs, Recursion and Dynamic Programming: notes and key points
More Trees, Graphs, Recursion and Dynamic Programming questions
- An undirected connected graph on 6 vertices has the edges (weights in brackets, all distinct): H–E (26), O–E (23), B–O (5), V–U (8), V–B…
- A tree has the vertices B, E, K, L, N, P, Y, Z and the edges N–E, N–B, E–L, N–K, E–Z, L–P, N–Y. What is the minimum number of vertices…
- An undirected graph has the vertices F, I, N, P, X, Y and the edges F–X, F–P, P–Y, P–X, I–Y, F–I, F–Y, F–N, N–I, I–X. What is the minimum…
- A directed graph has the vertices A, H, R, U, V, Y and the arcs V→A, A→H, A→R, U→R, H→R, Y→R, R→A, R→U, R→H. How many strongly connected…
- A directed graph has the vertices A, D, E, I, U and the arcs E→A, E→I, A→E, A→D, D→E, D→I, D→U, I→A, U→E, U→A, U→D. Count the directed…
- An undirected graph has the vertices A, G, N, O, S and the edges O–N, G–S, S–O, S–A, A–N, A–O, S–N. How many simple cycles does it contain…