Data Structures & AlgorithmsHardGATE CS · ICPC regional
A bipartite graph has left side P1, P2, P3 and right side Q1, Q2, Q3, Q4, Q5, with edges P1–Q5, P1–Q3, P3–Q4, P1–Q2, P2–Q1, P2–Q4, P3–Q3, P2–Q5. What is the size of a maximum matching (the largest set of edges with no shared endpoint)?
- A. 3
- B. 4
- C. 2
- D. 8
Correct answer: A. 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 3.
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 directed graph has the vertices E, G, Q, Z and the arcs E→Q, E→Z, G→E, G→Q, G→Z, Q→G, Q→Z, Z→E. Count the directed Hamiltonian paths…
- A grid has 4 rows and 3 columns with these values (top to bottom): 121 725 748 239 A path moves between side-adjacent cells (up, down…
- A tree has vertices with weights in brackets: A[9], J[13], P[6], Q[8], M[2], V[3], Y[6], R[8]. The edges are A–J, J–P, A–Q, Q–M, P–V, Q–Y…
- A directed graph with no directed cycles has arcs u→v (weight) : I→X (0), I→C (8), I→T (7), X→C (2), C→T (-3), T→Z (0). Weights may be…
- An undirected graph has the vertices F, J, M, S, Z and the edges Z–F, Z–J, S–F, S–M, S–J, F–J. What is its chromatic number, the least…
- Consider this function: python def g(n): if n < 2: return n if n % 2 == 0: return g(n - 1) + g(n - 3) return g(n - 3) - 1 What value does…