08 - Stable Matching, part 2.

08 - Stable Matching, part 2. - w prefers m’(M => m’...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
1/23/08 - Stable Matching, part 2. Lecture: Stable matching, part 2. Gale-Shapley Algorithm /* Init. */ All men and women are free. /* main loop */ while a free man m Assert: there exists a woman w that m hasn’t proposed to. Let w be the highest-ranked such woman. m proposes to w. If w is engaged to a man m’ whom she prefers to m, m remains free. Else (m, w) become engaged. If w was engaged to a man m’, m becomes free. endwhile return set of all engaged pairs (M) Each man proposes to women consecutively from the top of his list. (W) Each woman w, once engaged, remains engaged and to an improving sequence of men. Prop 1: For every free man during execution, a woman he has not proposed to. Proof. m if m has proposed to every woman, then every woman is engaged. n engaged women => n engaged men => m is engaged. Prop 2: At termination, all men and women are engaged, and the matching is stable. Proof. First half follows from Prop. 1 (all men/women engaged) Stability: Assume not. That means 4-1 4
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
m’ prefers w
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: w prefers m’ (M) => m’ already proposed to w. After that step, w was engaged to either m’ or someone better. At termination she’s engaged to m, contradicting (W). Therefore must be stable. During main loop: (1) ∃ ? free man O(n) --(2)--> O(1) (2) Fnd highest w m hasn’t proposed to O(n) --(1)--> O(1) (3) w is free or engaged O(1) (4) w prefers m to m’? O(n) Optimizations (1) m has a linked list of women in decreasing order of preference (2) Maintain a queue ±reeMen. (could be stack, etc., just need insert/remove O(1)) (3) w has linked list of men in increasing order of preference. Also a 2D array NotAChance[w, m] In total we spend O(n 2 ) time on (4) of main loop. Combined running time is O(n 2 ) Interval Scheduling You are the manager of a resource. There are requests {(s i , t i )} s i ≤ t i 4-2 A set of requests is feasible if it corresponds to disjoint intervals. Problem: Given a set of requests, Fnd a feasible subset of maximal cardinality 4-3...
View Full Document

{[ snackBarMessage ]}

Page1 / 3

08 - Stable Matching, part 2. - w prefers m’(M => m’...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online