Data Structures & AlgorithmsVery hardGATE CS · ICPC regional

An undirected graph has the vertices A, H, I, M, R, U, Y, Z and the edges M–Y, M–Z, M–I, M–U, M–H, A–U, A–H, R–Z, R–H, Y–Z, Y–I, Z–I, Z–H. What is the size of a maximum matching (a largest set of edges with no shared endpoint)?

  1. A. 6
  2. B. 4
  3. C. 3
  4. D. 5

Correct answer: B. 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.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic