Data Structures & AlgorithmsVery hardGATE CS · ICPC regional
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 maximum matching (a largest set of edges with no shared endpoint)?
- A. 4
- B. 5
- C. 3
- D. 2
Correct answer: C. 3
Because the graph contains an odd cycle it is not bipartite, so the bipartite shortcut of König's theorem does not apply; the true maximum is 3. Taking edges greedily in the listed order yields only 2, a maximal but not maximum matching.
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 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…
- A directed acyclic graph has the vertices K, L, P, U, W, X, Y and the directed edges Y→W, Y→K, K→L, K→X, P→K, U→X, W→X, W→P, U→P, U→K…
- A tree has the vertices B, D, K, O, Q, V, W, Y, Z and the edges D–K, K–W, W–V, D–B, W–Q, V–Y, V–Z, Q–O. A set D dominates the tree if…
- Each cell of a grid with 3 rows and 5 columns has an arrow: R = right, L = left, U = up, D = down. RDLLR UUDUR LDUDD From a cell you may…
- A directed graph with no directed cycles has arcs u→v (weight) : U→A (-3), U→V (4), A→Z (3), V→O (2), Z→O (5). Weights may be negative…