Last active
August 29, 2015 14:04
-
-
Save kartikkukreja/0167ca90ee90e359642e to your computer and use it in GitHub Desktop.
Stable Marriage Problem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Initially all m ∈ M and w ∈ W are free | |
| while ∃ m who is free and hasn't proposed to every woman: | |
| choose m | |
| Let w be the highest-ranked woman in m's preference list to whom m has not yet proposed | |
| if w is free: | |
| (m, w) become engaged | |
| elif w is currently engaged to m': | |
| if w prefers m' to m: | |
| m remains free | |
| else w prefers m to m': | |
| (m, w) become engaged | |
| m' becomes free | |
| return the set S of engaged pairs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment