Data Structures & AlgorithmsHardGATE CS · Codeforces Div 2 B
An undirected graph has the vertices C, F, M, N, Q, V, X, Z and the edges V–M, V–C, V–N, F–M, F–C, X–Z, X–Q, X–M, Z–M, Z–N, Q–M, M–C. What is the size of a maximum matching (a largest set of edges with no shared endpoint)?
- A. 6
- B. 5
- C. 3
- D. 4
Correct answer: D. 4
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 4. Taking edges greedily in the listed order yields only 3, 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 grid has 7 rows and 7 columns (top to bottom; '.' open, '#' blocked): .....#. .#..##. ....... .###... ....... #...... ....#.. You may…
- An undirected graph has the vertices G, I, R, U, Y and the edges I–U, Y–G, Y–U, G–U, R–U. What is its chromatic number, the least number…
- A tree has the vertices B, E, F, G, N, O, Q, R, S, V and the edges F–V, F–O, F–Q, Q–G, F–S, O–E, V–R, E–B, S–N. A set D dominates the tree…
- Two unmarked jugs hold 6 litres and 7 litres. Allowed operations: fill a jug completely, empty a jug completely, or pour one jug into the…
- A tree on the vertices D, E, F, I, L, Q, Y, Z has the arcs E→Y, F→Y, Z→Y, Z→L, Q→Z, D→Y, I→D (each undirected edge is directed as shown)…
- A connected undirected graph has the vertices B, E, F, O, Q and weighted edges (weights in brackets): B–O (11), F–O (10), B–Q (13), Q–E…