Lecture 5 CSE 331 Sep 9, 2011
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
Graded HW 0 Pick up in recitations or TA office hours next week
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!
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.
If you’re free this weekend http://www.cse.buffalo.edu/events/theory-IV/
Questions/Comments?
Two Questions Does a stable marriage always exist? If one exists, how quickly can we compute one?
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
Difference from the book In the book’s description, the men do the proposing
GS algorithm: Firefly Edition Mal Inara 1 2 3 4 5 6 Wash Zoe 1 Simon Kaylee
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
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
Today’s lecture At most n2 iterations of the while loop GS algorithms always outputs a stable marriage