Data Structures & AlgorithmsHardCodeforces Div 2 D · ICPC regional
An undirected graph has the vertices C, F, J, O, U, V, W, X, Z and the edges Z–O, Z–U, Z–C, F–U, F–J, O–J, O–V, O–W, U–W, U–X, U–C, V–W, V–X, V–C, W–X, W–C. What is the size of a maximum independent set (a largest set of vertices with no edge between any two of them)?
- A. 6
- B. 5
- C. 4
- D. 3
Correct answer: C. 4
Exhaustive search over subsets gives 4. Picking the currently lowest-degree vertex and deleting its neighbourhood (a common heuristic) gives 3, and n minus the maximum matching gives 5, which is not a general identity.
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
- Grid with 4 rows and 4 columns (top to bottom). A cell marked G is a gate; '.' is a normal cell: .G.G G... G... G... Each step, which is a…
- An undirected connected graph on 6 vertices has the edges (weights in brackets, all distinct): U–A (27), Y–M (6), I–Y (29), U–M (21), A–M…
- A pile holds p stones. In one move a player removes exactly s stones, where s is one of {2, 5} and s ≤ the pile size. The player who…
- An undirected graph has the vertices B, O, P, Q, T, V, Z and the edges Q–Z, Q–V, Q–T, P–Z, P–B, P–T, Z–O, Z–V, O–B. What is the size of a…
- A tree on the vertices C, F, I, R, V, X has the arcs C→R, V→C, I→V, V→X, F→V (each undirected edge is directed as shown). You may reverse…
- A directed acyclic graph has the vertices A, E, F, H, N, Q, R and the edges Q→N, Q→H, A→N, A→F, N→R, N→F, H→R, H→A, H→E. A topological…