2 Gale-Shapley Algorithm
This chapter covers
- Explaining what problem the algorithm solves, and why stability matters
- Demonstrating with an example how proposals are made and rejected until stability
- Analyzing the correctness, termination, optimality and proposer bias
- Applying the algorithm in real-world scenarios like college admissions
In the previous chapter, we looked at the core fundamentals of computer science and the components that drive today’s technology. We looked at data structures like hash maps, linked lists, stacks, and queues and how they perform by understanding the space and time complexities.
The Gale-Shapley algorithm was published in 1962 by David Gale and Lloyd Shapley. It is a stable matching algorithm that pairs equal numbers of participants to their preferences, like matching students to universities or online dating. It is also called the Deferred Acceptance Algorithm (DA) or the Propose-and-Reject Algorithm. This algorithm addresses one of the most elegant problems in combinatorial optimization, i.e., how to pair two equal-sized sets of participants based on their preferences in a way that no two individuals would rather be with each other than with their assigned preferences.