Lecture 8 CSE 331 Sep 17, 2010
Dec 22, 2015
Lecture 8
CSE 331Sep 17, 2010
HW 1 due today
Place Q1 and Q2 in separate piles
I will not accept HWs after 1:15pm
HW 1 solutions
At the end of the lecture
HW 2 has been posted
harder than HW 1, so start early!
Return signed forms
I’ll need confirmation in writing. No graded material will be handed back tillI get this signed form from you!
≤ n2 iterations of the while loopIntially 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 freeElse
(m,w) get engaged and w’ is free
Output the engaged pairs as the final output
Each iteration has one proposal
Each iteration has one proposal
Each proposal is newEach proposal is new
# iterations≤
# proposals≤
# pairs (m,w)≤n2
# iterations≤
# proposals≤
# pairs (m,w)≤n2
Today’s lecture
GS algorithms always outputs a stable marriage
Observation 1Intially 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 freeElse
(m,w) get engaged and w’ is free
Output the engaged pairs as the final output
Once a man gets engaged, he remains engaged (to “better”
women)
Once a man gets engaged, he remains engaged (to “better”
women)
Observation 2Intially 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 freeElse
(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
If w proposes to m after m’, then she prefers m’
to m
Questions/Comments?
HW 1 due today
Place Q1 and Q2 in separate piles
I will not accept HWs after 1:15pm
Proof technique de jour
Source: 4simpsons.wordpress.com
Proof by contradiction
Assume the negation of what you want to proveAssume the negation of what you want to prove
After some reasoning
After some reasoning
Claim: GS algo outputs a matching