4. Stable marriage problem
There is a group of women and a group of the same number of men. Each person has expressed his/her ranking for the members in the opposite group. The problem is to find a matching between the two groups such that the marriages are stable. A marriage between a man m and a woman w is said to be stable provided that:
- whenever m prefers another woman o to w, o prefers her spouse to m.
- whenever w prefers another man o to m, o prefers her spouse to w.
The following are the rankings: