Data Structures & AlgorithmsHardGATE CS · Codeforces Div 2
Bipartite graph with left side {A, B, C}, right side {D, E, F, G} and edges B–D, B–G, C–D, C–E, C–F. What is the size of a maximum matching (largest set of edges with no shared endpoint)?
- A. 2
- B. 3
- C. 5
- D. 4
Correct answer: A. 2
Trying every set of disjoint edges gives a maximum matching of size 2. Counting the edges, or assuming the smaller side is always matched, gives a wrong answer.
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
- Rooted tree with root 0 and vertices 0 to 9; the edges are 0–1, 1–2, 2–3, 2–4, 2–5, 0–6, 2–7, 7–8, 3–9 (parent–child). Every edge has…
- Array A = [6, 24, 27, 0, 7, 23, 30, 19]. How many index pairs i < j satisfy (A[i] XOR A[j]) < 25? (A trie with subtree counts answers this…
- Tree with vertices 0 to 9, root 0, edges 0–1, 1–2, 1–3, 1–4, 3–5, 1–6, 2–7, 5–8, 4–9 (parent–child). Vertex weights (vertex:weight) 0:16…
- Points A(4,3), B(7,5), C(8,9), D(6,6), E(4,6) in the plane. The cost of joining two points is the Manhattan distance |x1−x2| + |y1−y2|…
- A trie keeps a counter at each node, and every word of the list W = ['bb', 'bba', 'aabc', 'ac', 'aba', 'bbc', 'aab', 'ac'] is inserted…
- Directed graph on vertices A, B, C, D, E, F with edges E→F, E→A, C→D, D→C, D→B, B→C, A→C, A→D, B→D (no weights). What is the number of…