Data Structures & AlgorithmsVery hardGATE CS · ICPC regional

An undirected graph has the vertices C, D, F, L, U, X and the edges F–L, F–D, F–C, L–U, L–C, U–C, X–C. What is the size of a maximum matching (a largest set of edges with no shared endpoint)?

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

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

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic