Let $T=\{T_1 ...T_5 \}$ be a set of n=5 tutors and $L=\{L_1 ...L_7\}$ be the set of m=7 lectures. The tutors specified lectures they would like to hold (preferences for $T$) and they specified which, in their opinion, tutors should hold a given lecture (preference for $L$)
I do know how to calcualte the matching if both sets have the same cardinality. I could use the Gale–Shapley algorithm in that case. However, how do I deal with problems, where both $T$ and $L$ have preferences but the cardinality is not the same ?
Would appreciate any help.
As suggested by bof, you can extend the list of tutors with two dummy tutors $T_6, T_7$. The preferences for these additional tutors are:
After running Gale-Shapley on the extended list and receiving matching $M'$, you delete the matchings that involve $T_6$ and $T_7$ from $M'$ to receive $M$. This matching is stable.
Assume (towards a contradiction) that it is not stable. This means that there is a tutor (w.l.o.g. $T_1$) that is assigned to a lecture (w.l.o.g. $L_1$) but would prefer to teach lecture another lecture (w.l.o.g. $L_2$). Also, $L_2$'s preference for $T_1$ is higher than the preference of its match (or $L_2$ is not matched at all). If this is the case, then $M'$ was not stable to begin with - a contradiction.