HW1 solutions

HW1 solutions - Homework #1 (Solutions) 1. There is a...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
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 Gale-Shapley. 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 Gale-Shapley, 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 Gale-Shapley disallows unstable pairings of this type. 2. Order the following functions in order from smallest asymptotic running time to greatest.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/13/2010 for the course CSCI 570 taught by Professor Shamsian during the Fall '06 term at USC.

Page1 / 5

HW1 solutions - Homework #1 (Solutions) 1. There is a...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online