1. 一些算法问题
1.1 稳定匹配 Stable Matching Problem
GS算法 Propose-and-reject algorithm (GS algorithm)
伪码:
Initialize each person to be free.
while (some man is free and hasn't proposed to every woman) {
Choose such a man m
w = 1st woman on m's list to whom m has not yet proposed
if (w is free)
assign m and w to be engaged
else if (w prefers m to her fiancé m')
assign m and w to be engaged, and m' to be free
else
w rejects m
}
时间复杂度:
O(
n
2
n^2
n2)
性质:
- M按喜好降序请求
- W匹配后无法自由,只能被交易
- 全部M和W都会匹配
- 无不稳定匹配
- 对M最优匹配
- 对W最差匹配
- 每次执行产生相同匹配
- W有可能通过假偏好表改良匹配