Data Structures & AlgorithmsVery hardGATE CS · ICPC regional
An undirected graph has the vertices A, B, E, F, G, I, J, L, N, R and the edges G–J, G–B, G–R, J–F, J–R, F–L, F–B, F–N, F–E, L–N, L–R, A–R, A–I, A–E, B–R, B–I, B–E, N–I, R–E, I–E. 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. 3
- C. 5
- D. 4
Correct answer: D. 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
- A tree has the vertices A, C, F, N, O, S, W, Y, Z and the edges A–C, C–O, A–S, A–Z, O–N, A–F, C–Y, C–W. A centroid is a vertex whose…
- An undirected graph has the vertices J, N, T, U, Z and the edges Z–N, J–U, Z–U, Z–J, T–J, J–N, T–U, T–Z, N–U, T–N. What is the minimum…
- A directed weighted graph has the arcs u→v (weight): A→Y (11), A→L (15), W→D (4), W→S (10), Y→A (6), Y→W (3), Y→D (9), L→A (10), L→D (8)…
- Starting from the integer 13, one operation either adds 1, subtracts 1, or doubles the current value. Values may be any non-negative…
- Consider this recursive function: python def f(n): if n <= 1: return f(n - 2) if n % 3 == 0: f(n - 2) How many times is f called in total…
- An undirected graph on 6 vertices has the edges J–Y, J–K, Y–K, Y–P, K–T, T–P, T–C, P–C. How many simple paths (no repeated vertex) go from…