Data Structures & AlgorithmsVery hardGATE CS · Codeforces Div 2 B
A tree has the vertices B, E, F, G, N, O, Q, R, S, V and the edges F–V, F–O, F–Q, Q–G, F–S, O–E, V–R, E–B, S–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?
- A. 6
- B. 5
- C. 4
- D. 3
Correct answer: C. 4
A tree DP (or exhaustive search) gives domination number 4: {V, Q, S, E} dominates all 10 vertices, and no 3-vertex set does because the four leaves R, G, N, B have pairwise distinct neighbours. A minimum vertex cover has size 5, a different quantity.
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
- Two unmarked jugs hold 6 litres and 7 litres. Allowed operations: fill a jug completely, empty a jug completely, or pour one jug into the…
- A tree on the vertices D, E, F, I, L, Q, Y, Z has the arcs E→Y, F→Y, Z→Y, Z→L, Q→Z, D→Y, I→D (each undirected edge is directed as shown)…
- A connected undirected graph has the vertices B, E, F, O, Q and weighted edges (weights in brackets): B–O (11), F–O (10), B–Q (13), Q–E…
- An undirected graph has the vertices F, J, M, N, T, W and the edges J–F, J–W, J–T, F–W, N–T, W–M, W–T, M–T. What is its chromatic number…
- A directed acyclic graph has the vertices B, F, M, Q, R, V, W, X and the directed edges F→M, B→F, W→M, V→R, M→Q, F→Q, V→Q, B→V, B→X, B→R…
- A tree has vertices with values in brackets: B[8], C[0], L[-3], G[-1], N[3], V[5]. The edges are B–C, B–L, C–G, G–N, B–V. A path is any…