This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: i , w i )} n i+1 s.t. (1) Each man/woman is in exactly one pair. (2) ∄ pairs (m i , w i ), (m j , w j ) such that w j < m j w i , m i < w i m j First try. Local search. while ∃ (m i , w i ) s.t. w j < mj wi ⋀ m i < wi m j replace these pairs with (w i , m j ), (m i , w j ) counterexample: A: X > Z > Y B: Z > X > Y C: X > Y > Z X: B > A > C Y: A > B > C Z: A > B > C Potential for in±nite loop! Proposal algorithm /* Init */ All men/women are free /* main */ while ∃ a free man who hasn’t yet proposed to every woman m proposes to the highest-ranked w who didn’t yet reject him if w is free (m, w) become engaged else w is engaged to m’ 3-2 if m < w m’ m remains free else (m, w) become engaged m’ becomes free end Analysis Prop. Alg terminates after ≤ n 2 iterations of the loop Proof. In every loop iteration, a man proposes to a woman he never proposed to before. 3-3...
View Full Document
- Spring '08
- Algorithms, mj wi mi