Data Structures & AlgorithmsHardGATE CS · ICPC regional
Bipartite graph with left side {A, B, C, D}, right side {E, F, G, H} and edges A–E, A–F, A–H, B–G, C–F, C–H, D–E, D–H. What is the size of a maximum matching (largest set of edges with no shared endpoint)?
- A. 3
- B. 4
- C. 5
- D. 8
Correct answer: B. 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
- Array A = [30, 14, 22, 26, 8, 7] (all values below 32). What is the maximum of A[i] XOR A[j] over all index pairs with 0 ≤ i < j < 6?
- Words ['abd', 'bd', 'dac', 'cac', 'dcb', 'dab', 'dcc'] (each may be used at most once). A chain is a sequence of these words in which the…
- Connected undirected weighted graph on vertices A, B, C, D, E, F with edges A–B (14), A–C (14), A–D (6), A–E (3), B–C (16), B–D (20), B–E…
- Undirected weighted graph on vertices A, B, C, D, E, F with edges A–C (6), A–D (9), A–E (3), A–F (6), B–C (7), B–E (3), B–F (3), D–F (3)…
- Directed acyclic graph on vertices A, B, C, D, E with edges A→C, A→E, E→B. Among all topological orderings (every edge goes from earlier…
- Distinct keys [6, 20, 4, 25, 16] are inserted, in the order given by the sequence [16, 25, 20, 6, 4], into an empty binary search tree…