There are men and women. Each person has a priority list of people they’d like to marry. Find a way to marry each man and woman together such that no two non-married man/woman pair prefer each other more than they prefer their current partners

Gale-Shapley Algorithm:

  • While there are unmarried men who haven’t exhausted their options
    • Let choose the highest person on his priority list he hasn’t asked yet
    • If is free
      • Engage and
    • If is already engaged to
      • If on ‘s priority list
        • Engage and
        • Make free
      • Else
        • and remain engaged
  • Let all engaged people marry

Claims

  • Men will get their best valid match
    • Valid meaning a match that will still enable stable matching
  • Women will get their worst valid match