Homework #1
(Solutions)
1. There is a software engineering class with 3
n
students, comprised of
n
students who are
experienced with computer graphics,
n
students who are experienced with algorithms, and
n
students who are experienced with programming languages. The project for the course has
students working in groups of 3, with each group having a student from each category. Each
student has a preference list of who they wish to be matched with. A matching is unstable
if there are two groups (
A, B, C
) and (
D, E, F
), for which
A
and
B
prefer
F
to
C
, and
F
prefers
A
to
D
and
B
to
E
. Design an algorithm which produces a stable matching and prove
its correctness, or prove that no such algorithm is possible.
Solution
Our algorithm is as follows. We first match up graphics students to algorithms students via
GaleShapley. These now form pairs; we form preference lists for the PL students by averaging
their ranking of each (graphics, algorithms) pair and sorting by this, breaking ties arbitrarily.
Preference lists for the (graphics, algorithms) pairs are formed similarly.
This produces a stable matching. Proof (by contradiction):
Suppose there are two unstable trios
g
1
= (
x, y, z
) and
g
2
= (
x
0
, y
0
, z
0
), where
x
and
x
0
are
graphics students,
y
and
y
0
are algorithms students,
z
and
z
0
are programming language
students.
If the graphics students are the unstable pair, then this means that
y
prefers
x
0
to
x
, and
x
0
prefers
y
to
y
0
. This is a contradiction, however, as we paired the graphics and
algorithms students via GaleShapley, which has no unstable pairings. The case where the
algorithms students are the unstable pair is identical.
Therefore,
z
and
z
0
are the unstable pair.
This means that
x
prefers
z
0
to
z
,
y
prefers
z
0
to
z
,
z
0
prefers
x
to
x
0
, and
z
0
prefers
y
to
y
0
. If we average the ranking of each (graphics,
algorithms) pair, and refer to these pairs as
xy
and
x
0
y
0
, then this means that
xy
prefers
z
0
to
z
, and
z
0
prefers
xy
to
x
0
y
0
.
This is also a contradiction, as the second iteration of
GaleShapley disallows unstable pairings of this type.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '06
 Shamsian
 Software engineering, Algorithms, Computer Graphics, Recurrence relation, Marble, Master Theorem

Click to edit the document details