Propose-and-Reject (Gale-Shapley) Algorithm

theoretical explanation

  1. everybody (all those from the 2 sides) submit their preference list, ranking the other side
  2. 1st side choosing other people of the 2nd side. those of 2nd side with many selections will reject all but their top suitors. Those who match will form a tentative pair
  3. each 1st side people rejected then propose the their next rank choices (whether their choices are free or not). 1st side and 2nd side people, forming the previously tentative pair, can reconsider and make new pair
  4. iterate step 1-3
  • example

implementation

algorithm analysis

  • termination guaranteed? β†’ Yes, at most proposals/rounds of the algorithm
    • n men, in worst case, each man has to propose to n women in order to find a match β‡’
  • everyone gets a match guaranteed? β†’ Yes
  • result allocation guaranteed stable? β†’ Yes