Template for homework
Note: The stable matching problem is very well known with a very well known solution, called the Gale-Shapley Algorithm (link shows importance of stable matching).
Video how explaining how it works.
The solution presented in lecture is backtracking, not Gale-Shapley, which you will cover in CS323 (algorithms).
Suppose we have n men and n woman, each with their own preference for the opposite sex.
Can we create a matching such that there is no unstable pairings?
What is an unstable pairing?:
An unstable pairing is one where a man likes another woman more than his current partner and that same woman likes
that same man more than her current partner (In which case they would run away together--hence the unstable pairing).
The correct output is displayed below.