A Systematic Approach to Algorithms

Vijay K. Garg · The University of Texas at Austin

Chapter 3. The Stable Marriage Problem

The Gale-Shapley algorithm in its imperative form.

This page: Classical forms. View LLP forms »

GaleShapley

The classical man-optimal algorithm: each iteration picks any free man and lets him propose to his next preference. G[i] records the number of proposals man i has made so far.

Time complexity: $O(n^2)$, where $n$ is the number of men (= number of women).

Looking ahead

The lattice-linear reformulation that this classical algorithm implicitly walks through is on the LLP companion page: it makes explicit that Gale-Shapley is a forbidden/advance loop on the proposal-vector lattice.