The Stable Matching Problem we discussed in class was a simplified version of
the more general Coop Student/Company Matching Problem that I mentioned initially.
In this question, you will go back and consider the more general problem.
Suppose that there are n students applying for jobs, and m companies
where company i is looking for ni COOP students. Suppose
moreover that there are enough students to fill all of the positions, that every
student has a ranking of companies in order of preference, and that each company has
a ranking of students in order of preference. An assignment of students to companies
is stable if neither of the following two situations arises:
- There are two students s and s', and a company c such
that s is assigned to c, s' is unemployed, and c
prefers s' to s.
- There are two students s and s', and companies c
and c', such that s is assigned to c, s' is assigned
to c', s prefers c' to c, and c' prefers s
to s' (this is the usual type of instability we discussed in class).
Describe an efficient algorithm that will produce a stable assignment of
students to companies.