Data Structures & AlgorithmsHardICPC regional · GATE CS top band
Bipartite graph with left side {A, B, C, D}, right side {E, F, G, H} and edges A–E, B–E, B–H, C–E, C–F, C–G, C–H, D–E. What is the size of a maximum matching (largest set of edges with no shared endpoint)?
- A. 3
- B. 5
- C. 4
- D. 8
Correct answer: A. 3
Trying every set of disjoint edges gives a maximum matching of size 3. 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
- Distinct words ['bbba', 'aaa', 'bcaa', 'aac', 'b'] are inserted into an empty trie (one node per character, shared prefixes sharing nodes…
- A binary tree with distinct letters has preorder ACDEBF and inorder DEBCAF. What is its postorder traversal (left, right, root), written…
- Directed weighted graph on vertices B, F, A, C, D (source B, target D) with edges: B→F (2); B→A (5); A→F (-4); F→D (1); A→D (3); B→D (12)…
- Distinct words ['cc', 'aab', 'a', 'cbc', 'bbb', 'bc'] are inserted into an empty trie (one node per character, shared prefixes share…
- Directed weighted graph on vertices F, E, D, B, C (source F, target C) with edges: F→E (5); F→D (8); D→E (-5); E→C (1); D→C (6); F→C (8)…
- A trie keeps a counter at each node, and every word of the list W = ['c', 'b', 'baba', 'a', 'b', 'cc', 'ccb', 'cb'] is inserted once per…