Data Structures & AlgorithmsHardCodeforces Div 2 D · ICPC regional
A bipartite graph has left side P1, P2, P3, P4 and right side Q1, Q2, Q3, Q4, Q5, with edges P1–Q1, P4–Q1, P1–Q2, P1–Q5, P4–Q5, P2–Q5, P4–Q4. What is the size of a maximum matching (the largest set of edges with no shared endpoint)?
- A. 4
- B. 3
- C. 7
- D. 2
Correct answer: B. 3
Augmenting paths (Kuhn's algorithm) reach a matching of size 3. Greedy matching that takes the first free neighbour for each left vertex gets 3, and the smaller side only bounds the matching at 4.
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 tree has vertices with weights in brackets: Y[6], L[12], B[1], X[10], W[6], I[3], N[4], V[14], J[7]. The edges are Y–L, Y–B, L–X, L–W…
- A directed graph has the vertices D, F, M, O, S and the arcs M→D, M→O, D→O, D→F, O→S, F→O, S→M. Count the directed Hamiltonian paths…
- On an 7×7 chessboard, rows and columns are numbered 0 to 6, and squares are written (row, column). A knight moves in the usual L-shape…
- A directed acyclic graph has the vertices A, F, J, K, P, R, S and the edges P→A, P→F, A→F, J→F, J→S, J→R, S→F. A topological order lists…
- A counter starts at 1. Each step, you may add 1, add 2, or double the counter. Each step must stay at or below 23. Two sequences of steps…
- Bellman–Ford is run from source S on the directed graph whose arcs (weights in brackets) are listed in the order they are relaxed: S→E…