Data Structures & AlgorithmsHardGATE CS · ICPC regional
An undirected graph has the vertices A, J, L, Q, W, X, Y and the edges L–J, L–X, L–W, L–A, Q–X, Q–A, J–Y, Y–W. What is the size of a maximum independent set (a largest set of vertices with no edge between any two of them)?
- A. 3
- B. 4
- C. 5
- D. 6
Correct answer: B. 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 4, 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
- A pile holds p stones. In one move a player removes exactly s stones, where s is one of {1, 2, 4} and s ≤ the pile size. The player who…
- An undirected graph has the vertices F, J, K, M, S, T, V, X and the edges J–V, J–X, J–F, J–M, J–K, V–F, V–S, X–F, X–M, X–K, F–K, S–M. What…
- An undirected graph has the vertices A, J, K, L, O, Q, X, Y and the edges J–Q, J–Y, J–A, J–O, Q–L, Q–X, K–L, K–O. What is the size of a…
- An undirected graph has the vertices C, E, H, K, M, N, T, Y and the edges E–M, E–N, E–Y, E–T, C–N, C–H, C–Y, C–T, M–N, M–K, N–K, Y–T. What…
- 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…
- 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…