(Latest Revision: Tue Feb 16, 2021) SOLUTION TO Take Home Exercise #1

Take Home Exercise #1

SOLUTION TO:
CS 4400 Practice Exercise
Stable Matching Problem


==============================
==============================
Your Assignment:

Process the following input in the same manner the sample input was 
processed, as illustrated above.

Produce the same kind of script (step-by-step) of the actions taken by 
the Gale-Shapley algorithm, plus write what the final matching is, 
in the same format as above.

The men are Abe, Ben, Cal, and Dan.  
The women are Eve, Fey, Gem, and Hil.

The preference lists are 

Abe  Fey  Eve  Hil  Gem
Ben  Hil  Fey  Eve  Gem
Cal  Fey  Gem  Hil  Eve
Dan  Eve  Hil  Gem  Fey

Eve  Abe  Ben  Dan  Cal
Fey  Cal  Ben  Dan  Abe  
Gem  Ben  Cal  Dan  Abe
Hil  Abe  Dan  Cal  Ben

Abe proposes to Fey.
Fey pairs with Abe because she is free.
Ben proposes to Hil.
Hil pairs with Ben because she is free.
Cal proposes to Fey.
Fey rejects Abe.
Fey pairs with Cal because she likes him more.
Abe becomes free.
Abe proposes to Eve.
Eve pairs with Abe because she is free.
Dan proposes to Eve.
Eve rejects Dan because she likes her current match, Abe, more.
Dan remains free.
Dan proposes to Hil.
Hil rejects Ben.
Hil pairs with Dan because she likes him more.
Ben becomes free.
Ben proposes to Fey.
Fey rejects Ben because she likes her current match, Cal, more.
Ben remains free.
Ben proposes to Eve.
Eve rejects Ben because she likes her current match, Abe, more.
Ben remains free.
Ben proposes to Gem.
Gem pairs with Ben because she is free.
Now everyone has a match.


Here Are The Matches: 

   WOMEN     MEN
     Eve     Abe
     Fey     Cal
     Gem     Ben
     Hil     Dan