(Latest Revision: Fri Mar 06, 2020) 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.

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

The preference lists are 

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

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

 1.   Abe proposes to Hil.
 2.   Hil pairs with Abe because she is free.
 3.   Ben proposes to Gem.
 4.   Gem pairs with Ben because she is free.
 5.   Cal proposes to Gem.
 6.   Gem rejects Cal because she likes her current match, Ben, more.
 7.   Cal remains free.
 8.   Cal proposes to Fey.
 9.   Fey pairs with Cal because she is free.
10.   Dan proposes to Gem.
11.   Gem rejects Dan because she likes her current match, Ben, more.
12.   Dan remains free.
13.   Dan proposes to Hil.
14.   Hil rejects Dan because she likes her current match, Abe, more.
15.   Dan remains free.
16.   Dan proposes to Eve.
17.   Eve pairs with Dan because she is free.

Now everyone has a match.

Here Are The Matches:

   WOMEN     MEN
     Eve     Dan
     Fey     Cal
     Gem     Ben
     Hil     Abe