This preview shows page 1. Sign up to view the full content.
Unformatted text preview: then for n = k, the algorithm will attempt to make matches until the An-Jn match is made, at which time the marriage will finally become stable. Since each iteration within the for loop removes Jn and Ai to be matched up later, the recursive call will be made on an applicant set A and a job set J of cardinality k-1 and of which every element of each set have a list of preference into the other set in the exact opposite order, which can be exchanged exactly as the input for the subproblem of n=k-1, which from the induction hypothesis takes O ((n-1)!) time to solve. However, since we can guarantee that no set of marriages are stable until the An-Jn match is made, which doesnt happen until after the for loop iterates for n steps, we will have to solve the same subproblem of order O((n-1)!) n times, making for O(n!) complexity....
View Full Document
- Spring '08