Data Structures & AlgorithmsHardGATE CS · Codeforces Div 2 B
An undirected graph has the vertices C, E, H, I, M, N, O, R, U, Y and the edges H–R, H–E, H–N, H–M, C–O, C–R, C–E, C–N, C–M, C–Y, C–I, O–N, O–U, O–M, O–Y, R–N, R–M, E–U, E–M, E–Y, N–U, N–I, U–M, U–Y, M–Y, M–I, Y–I. 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. 4
- C. 3
- D. 5
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 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 D, J, K, M, O, R, U, W, Z and the edges K–Z, K–M, Z–D, M–U, D–J, D–W, D–O, K–R. A centroid is a vertex whose…
- A tree has vertices with values in brackets: A[-2], U[8], Y[5], G[0], Z[-3], V[6], T[1], J[-2]. The edges are A–U, U–Y, Y–G, G–Z, A–V…
- A tree has vertices with values in brackets: O[1], Y[4], S[5], A[2], U[2], L[6]. The edges are O–Y, Y–S, Y–A, O–U, O–L. A path is any…
- The directed acyclic graph has the vertices D, O, R, T, U, Y and the arcs Y→O, T→O, O→R, Y→T, Y→D, Y→R, T→R, T→U. How many distinct…
- A connected undirected graph has the vertices B, F, M, O, Z and weighted edges (weights in brackets): O–M (16), F–Z (14), B–M (7), O–B…
- An undirected graph has the vertices C, J, L, Q, W and the edges W–L, J–C, L–C, J–Q, Q–L, W–C, W–J, W–Q. How many simple cycles does it…