Let's trace it for
- M: {A, B, C}
- W: {1, 2, 3}
- A: 1, 2, 3
- B: 2, 1, 3
- C 1, 2, 3
- 1: A, B, C
- 2: A, C, B
- 3: A, C, B
Start
A(F): 1 2 3 B(F): 2 1 3 C(F): 1 2 3
1(F): A B C 2(F): A C B 3(F): A C B
S:
Step 1, select C (This is a choice to exercise the algorithm.)
The first person on C's list is 1
1 does not have a match, (C, 1) becomes a match
A(F): 1 2 3 B(F): 2 1 3 C(E): {1} 2 3
1(E): A B C 2(F): A C B 3(F): A C B
S: (C, 1)
Step 2, Select A (This is a choice to exercise the algorithm)
The first person on A's list is 1
1 Prefers A to C
(A, 1) becomes a match
Mark A as E
Mark C as F
Note (A, 1) Are effectively removed.
A(E): {1} 2 3 B(F): 2 1 3 C(F): {1} 2 3
1(E): A B C 2(F): A C B 3(F): A C B
S: (A, 1)
Step 3, Select B (This is a choice to exercise the algorithm)
B prefers 2
2 is free so (B, 2) Becomes a match
A(E): {1} 2 3 B(E): {2} 1 3 C(F): {1} 2 3
1(E): A B C 2(E): A C B 3(F): A C B
S: (A, 1) (B, 2)
Step 4, Select C (Only choice)
The current first person on C's list is 2
2 is matched with B, but prefers C
(C, 2) becomes a match.
A(E): {1} 2 3 B(F): {2} 1 3 C(E): {1 2} 3
1(E): A B C 2(E): A C B 3(F): A C B
S: (A, 1) (C, 2)
Step 5, Select B (Only Choice)
B selects 1, but is rejected as 1 has a better match.
A(E): {1} 2 3 B(F): {2 1} 3 C(E): {1 2} 3
1(E): A B C 2(E): A C B 3(F): A C B
S: (A, 1) (C, 2)
Step 6, Select B (Only Choice)
B selects 3
3 is free
(B, 3) Becomes a match
A(E): {1} 2 3 B(E): {2 1 3} C(E): {1 2} 3
1(E): A B C 2(E): A C B 3(F): A C B
S: (A, 1) (C, 2) (B, 3)
There is no one left who is not engaged so the algorithm ends.