Stable Marriage Example
Four women, Alice, Barbara, Cathy and Daniele, and four men, Eric,
Frank, George and Harry, decide that they are all going to get
married. The problem is they can't decide who is going to marry whom.
They also don't necessarily agree on how much they like each other.
They decide that each person will rank the members of the opposite sex
(1 being favorite, 4 being least favorite).
Divorce happens when two people, who are not currently married to each
other, decide that they like each other better than their current
spouses. This situation is called unstable . A marriage is
stable if there are no unstable couples. Compute a stable marriage.
Men's rankings
| Alice | Barbara | Cathy
| Daniele |
|
Eric | 1 | 2 | 4 | 3
|
Frank | 1 | 4 | 3 | 2
|
George | 3 | 1 | 2 | 4
|
Harry | 2 | 4 | 1 | 3
|
Women's rankings
| Alice | Barbara | Cathy
| Daniele |
|
Eric | 4 | 2 | 3 | 1
|
Frank | 1 | 3 | 1 | 4
|
George | 2 | 4 | 2 | 2
|
Harry | 3 | 1 | 4 | 3
|