This preview has intentionally blurred sections. Sign up to view the full version.
View Full 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 42 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 43...
View
Full Document
 Spring '08
 KLEINBERG
 Algorithms, Order theory, main loop

Click to edit the document details