Data Structures & AlgorithmsHardGATE CS · Codeforces Div 2 C
A bipartite graph has left vertices 0 to 3 and right vertices 0 to 3. Its edges, as (left, right) pairs in this listed order, are: (3,2), (2,0), (2,2), (0,2), (3,0), (1,2), (2,3), (3,3). What is the size of a maximum matching (largest set of edges with no shared endpoint)?
- A. 3
- B. 2
- C. 4
- D. 8
Correct answer: A. 3
Augmenting paths give a maximum matching of size 3. Taking edges greedily in listed order stops at 2, which is 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 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: (0,1)…
- Directed graph on vertices 0 to 4 with positive weights (u→v (w)): 3→2 (1), 4→1 (3), 2→3 (1), 2→4 (1), 4→0 (2), 0→3 (1), 0→1 (1), 2→0 (3)…
- Directed graph on vertices 0 to 5 with positive weights (u→v (w)): 5→4 (2), 3→5 (2), 5→0 (3), 4→1 (1), 5→2 (3), 3→1 (1), 4→0 (3), 1→4 (3)…
- Directed graph on vertices 0 to 6 with positive weights (u→v (w)): 5→1 (3), 2→6 (2), 4→0 (2), 4→1 (1), 3→1 (2), 5→4 (2), 3→0 (3), 3→6 (3)…
- Directed graph on vertices 0 to 6 with positive weights (u→v (w)): 4→0 (1), 1→6 (3), 5→6 (2), 4→6 (2), 6→1 (2), 3→4 (3), 3→6 (2), 1→5 (2)…
- Directed graph on vertices 0 to 6 with positive weights (u→v (w)): 1→6 (3), 6→1 (1), 0→4 (2), 0→3 (2), 5→4 (2), 0→2 (2), 3→6 (3), 2→3 (1)…