Data Structures & AlgorithmsHardGATE CS · Codeforces Div 2
Bipartite graph with left side {A, B, C, D}, right side {E, F, G, H} and edges A–E, A–G, A–H, B–E, B–H, C–E, D–E, D–F, D–G. What is the size of a maximum matching (largest set of edges with no shared endpoint)?
- A. 9
- B. 4
- C. 5
- D. 3
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
- Strings a = "abbacc" and b = "caaca". The edit distance allows insert, delete and substitute, each costing 1 (the standard Levenshtein…
- Undirected simple graph on vertices A, B, C, D, E, F with edges A–B (1), A–D (1), A–E (1), A–F (1), B–E (1), C–D (1), C–E (1), E–F (1)…
- Connected undirected weighted graph on vertices A, B, C, D with edges A–B (3), A–D (5), B–C (6), B–D (3), C–D (4). Among all spanning…
- Directed weighted graph on vertices D, C, E, F, B (source D, target B) with edges: D→C (6); D→E (7); E→C (-4); C→B (4); E→B (5); D→B (11)…
- Undirected simple graph on vertices A, B, C, D, E, F with edges A–B (1), A–C (1), A–D (1), A–F (1), B–C (1), B–D (1), B–E (1), B–F (1)…
- A chain of 5 matrices M1 to M5 has dimensions given by the sequence p = [8, 7, 16, 17, 9, 9], where Mi has size p[i−1] × p[i] (1-indexed)…