algorithm - counter example of a stable matching -


i reading algorithm book , came across stable matching problem. , question came mind i'm curious about, book doesn't answer. question is:
for matching, if not stable, pick blocking pair(w, m), , match them. , match previous partners. , repeat. correct algorithm reach stable matching?
it seems answer no. can not think out counter example. there can help?

i think have found answer. suppose have 3 women , 3 men. preference list of them are:
w1: m3 > m2 > m1
w2: m2 > m3 > m1
w3: don't care

m1: don't care
m2: w1 > w2 > w3
m3: w2 > w1 > w3

the initial matching: (w1,m1) (w2,m2) (w3,m3)
step 1: w1 , m2 match, (w1,m2) (w2,m1) (w3,m3)
step 2: w1 , m3 match, (w1,m3) (w2,m1) (w3,m2)
step 3: w2 , m3 match, (w2,m3) (w1,m1) (w3,m2)
step 4: w2 , m2 match, (w1,m1) (w2,m2) (w3,m3)

after 4 steps, matching goes initial state, leads infinite loop.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -