Data Structures & AlgorithmsHardGATE CS · ICPC regional
Bipartite graph with left side {A, B, C, D}, right side {E, F, G, H} and edges A–G, B–F, B–G, C–E, C–H, D–E. What is the size of a maximum matching (largest set of edges with no shared endpoint)?
- A. 4
- B. 2
- C. 6
- D. 5
Correct answer: A. 4
Trying every set of disjoint edges gives a maximum matching of size 4. 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
- Weighted tree on vertices 0 to 7 with edges 0–1 (4), 0–2 (2), 0–3 (8), 0–4 (5), 1–5 (8), 0–6 (4), 0–7 (2). What is the largest possible…
- 2 × 3 sliding puzzle with tiles 1 to 5 and one blank (shown as ). Current board: 2 4 3 / 1 5 . Goal board: 1 2 3 / 4 5 . A move slides a…
- Undirected simple graph on vertices A, B, C, D, E, F, G with edges A–B (1), A–E (1), A–F (1), C–E (1), D–E (1), D–G (1), E–F (1), F–G (1)…
- Distinct keys [25, 10, 8, 14, 19] are inserted, in the order given by the sequence [19, 8, 14, 10, 25], into an empty binary search tree…
- Undirected weighted graph on vertices A, B, C, D, E with edges A–B (3), A–C (3), A–D (1), B–E (1), C–D (2), C–E (3). How many distinct…
- Distinct keys [3, 21, 7, 19, 24] are inserted, in the order given by the sequence [7, 21, 19, 24, 3], into an empty binary search tree…