Data Structures & AlgorithmsModerateGATE CS · Codeforces Div 2 C

A bipartite graph has left vertices 0 to 4 and right vertices 0 to 4. Its edges, as (left, right) pairs in this listed order, are: (4,4), (4,2), (0,2), (0,1), (1,4), (4,1), (0,3), (4,3), (1,2), (0,4), (3,1), (3,4), (4,0), (3,2). What is the size of a maximum matching (largest set of edges with no shared endpoint)?

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

Correct answer: D. 4

Augmenting paths give a maximum matching of size 4. Taking edges greedily in listed order stops at 3, which is a maximal but not maximum matching.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic