Posted by: atri | September 16, 2010

Lecture 7: GS Algorithm terminates

(Guest post by Roy Okoroji)

In class we discussed about the GS algorithm and its function such as the following.

Initially 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


(m,w) get engaged and w’ is free

Output the engaged pairs as the final output

A preference list was as well used which was called the firefly Edition. But i will be using ABC & 123 to represent the firefly edition.

A 1 2 3     1 A B C

B 2 1 3     2 A B C

C 3 1 2     3 A B C

E = Empty

B E E 3 3 2 2

3 1 E B B E C


A better representation of  the Gale Shapley Algorithm can be seen here . Then scroll down to Wed, Sep 15 GS Algorithm terminates

Or click here -> Slides


At most n^2 Iterations of the while loop

GS algorithm always outputs a stable marriage

Claim: For every input the Gs algorithm iterates over when the while loop

FACT: # (m,w) pairs = n^2


->  Each iteration has 1 proposal

-> Can have ≤ 1 proposal / pair (m,w)

->  n^2 pairs => ≤ n^2 proposals



m1                         w1

m2                         w2

m3                         w3

(m1, w1)(m1, w2)(m1, w3)

Proof: Define “progress measures”

Let p(t) = # proposals made at the end of iteration t

-> (1) p(t-1) = p(t) +1 => For every iteration t.

-> (2) for any t, P(t) ≤ n^2

-> P(t) ≤ # pairs (m,w) = n^2

=> P(t) can increase ≤ n^2 times

=> ≤ n^2 iteration

P(t*) = t*

t* = P(t*) ≤ n^2

t* = # final iteration

Proof of (1) : By algorithm definition, there is some proposal (m,w) + Some proposal cannot be made more than once

Proof of (2): Every proposal (m,w) is also a pair => max # proposals ≤ M x W = n^2


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: