Data Structures & AlgorithmsHardICPC regional · matching theory
Problem: What does the Gale-Shapley algorithm guarantee for stable matching with n men and n women?
- A. A maximum-weight matching is always found
- B. A stable matching is found in O(n^2) proposals
- C. Every man gets his first choice
- D. It runs in O(n log n) always
Correct answer: B. A stable matching is found in O(n^2) proposals
Each man proposes at most once to each woman, so at most n^2 proposals occur and the result is stable.
More Coding Interview Problems questions
- Problem: How many states does a bitmask DP over subsets of n = 15 items have?
- Problem: Which statement about the Floyd-Warshall algorithm's memory usage for V vertices is correct?
- Problem: Which problem asks for the minimum number of edges to add to make a graph 2-edge-connected?
- Problem: What does 'lazy propagation' in a segment tree guarantee for a range-add update?
- Problem: Which result is the basis of Mo's algorithm's complexity analysis?
- Problem: What is the expected number of comparisons of randomised quicksort on n distinct elements?