However, A1 prefers J2 to J1 while J2 prefers A1 to A2, hence while this is the minimum costing
solution, it is in no way stable.
1(b). Construction of the input
:
We want to find an input that given a certain set of transformations, will return to one of its
intermediate states. These transformations can be expressed as adding additional constraints to
the preference of the jobs and applicants that do no conflict with previous constraints, and from
these we can construct the preference list of each applicant and job.
We will start with the basic 4x4 ladder configuration:
The set of transformations are as follows:
1->2: (A1: J2>J1, J2: A1>A2)
2->3: (A1: J3>J2, J3: A1>A3)
3->4: (A1: J4>J3, J4: A1>A4)
4->5: (A4: J1>J3, J1: A4>A2)
5->6: (A3: J4>J2, J4: A3>A1)
6->7: (A3: J1>J4, J1: A3>A4)
7->8: (A3: J3>J1, J3: A3>A2)
which gives us the following preference list:
A1: [J4, J3, J2, J1]
J1: [A3, A4, A2]
A2: [J1, J3]
J2: [A1, A2]
A3: [J1, J3, J4, J2]
J3: [A1, A3, A2]
A4: [J1, J3]
J4: [A3, A1, A4]
Note that entries with less than 4 elements can add the other elements in any order as only the
relative positions of the elements within the ordering in the above diagram are important.
1(c). Input:
Give the applicant set {A1, A2, …, An} and the job set {J1, J2, …, Jn} such that every applicant
and every job ranks the other in exactly the reverse order. E.g. each applicant has preference in
the order of {Jn, Jn-1, …, J1} and each job has preference in the order of {An, An-1, …, A1}.
Complexity
: The above input will cause the program to run in O (n!) which is exponential.
Base case: if we’re given that n = 1, then there’s exactly one matching between J1 and A1, which
is stable by default. So one operation is performed which is exponential in 1.