Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 5 CSE 331 Sep 9, 2011.

Similar presentations


Presentation on theme: "Lecture 5 CSE 331 Sep 9, 2011."— Presentation transcript:

1 Lecture 5 CSE 331 Sep 9, 2011

2 Homework 1 has been posted
READ THE INSTRUCTIONS VERY CAREFULLY Posted online (link on the blog) Grading rubric will be posted by Tuesday next week

3 Graded HW 0 Pick up in recitations or TA office hours next week

4 Not all signed forms turned in
I’ll need confirmation in writing. No graded material will be handed back till I get this signed form from you!

5 A puzzle (if you’re bored)
For any n, what is the maximum number of stable matchings (for the same problem instance)? Prove as tight upper and lower bounds as you can.

6 If you’re free this weekend

7 Questions/Comments?

8 Two Questions Does a stable marriage always exist?
If one exists, how quickly can we compute one?

9 Gale-Shapley Algorithm
Intially all men and women are free While there exists a free woman who can propose Let w be such a woman and m be the best man she has not proposed to w proposes to m If m is free (m,w) get engaged Else (m,w’) are engaged If m prefers w’ to w w remains free Else (m,w) get engaged and w’ is free Output the engaged pairs as the final output

10 Difference from the book
In the book’s description, the men do the proposing

11 GS algorithm: Firefly Edition
Mal Inara 1 2 3 4 5 6 Wash Zoe 1 Simon Kaylee

12 Once a man gets engaged, he remains engaged (to “better” women)
Observation 1 Intially all men and women are free While there exists a free woman who can propose Let w be such a woman and m be the best man she has not proposed to w proposes to m If m is free (m,w) get engaged Once a man gets engaged, he remains engaged (to “better” women) Else (m,w’) are engaged If m prefers w’ to w w remains free Else (m,w) get engaged and w’ is free Output the engaged pairs as the final output

13 If w proposes to m after m’, then she prefers m’ to m
Observation 2 Intially all men and women are free While there exists a free woman who can propose Let w be such a woman and m be the best man she has not proposed to w proposes to m If m is free If w proposes to m after m’, then she prefers m’ to m (m,w) get engaged Else (m,w’) are engaged If m prefers w’ to w w remains free Else (m,w) get engaged and w’ is free Output the engaged pairs as the final output

14 Today’s lecture At most n2 iterations of the while loop
GS algorithms always outputs a stable marriage


Download ppt "Lecture 5 CSE 331 Sep 9, 2011."

Similar presentations


Ads by Google