Data Structures & AlgorithmsVery hardCodeforces Div 2 C · GATE CS
An undirected graph has the vertices B, C, D, E, I, M, R, S, V and the edges S–B, I–M, I–V, R–M, R–D, R–V, R–C, D–C, V–C, E–B, B–C. What is the size of a maximum independent set (a largest set of vertices with no edge between any two of them)?
- A. 4
- B. 7
- C. 6
- D. 5
Correct answer: D. 5
Exhaustive search over subsets gives 5. Picking the currently lowest-degree vertex and deleting its neighbourhood (a common heuristic) gives 4, 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
- An undirected graph has the vertices C, D, K, M, Q, V and the edges Q–D, Q–M, C–D, K–D, K–V, D–M, D–V. What is the size of a maximum…
- Cities F, M, O, R, S are joined by roads with these travel costs: M–O 11, M–S 20, M–R 7, M–F 16, O–S 16, O–R 14, O–F 8, S–R 11, S–F 8, R–F…
- A tree has the vertices D, F, I, O, Q, R, S, U, X and the edges I–S, I–U, I–O, I–D, D–X, D–F, U–Q, X–R. What is the minimum number of…
- A tree on the vertices E, H, K, S, U, X has the arcs E→S, S→H, H→K, U→H, X→K (each undirected edge is directed as shown). You may reverse…
- A directed graph has the vertices E, G, L, N, U and the arcs N→L, N→E, N→G, L→N, L→E, U→N, U→L, U→E, U→G, E→L, E→U, E→G, G→U, G→E. Count…
- A connected undirected graph has the vertices A, I, J, N, O, X, Z and the edges A–X, A–O, X–O, X–I, O–Z, O–N, I–N, I–J. How many bridges…