Homework1_Solutions

.pdf

School

University of Texas *

*We aren’t endorsed by this school

Course

360C

Subject

Computer Science

Date

Dec 6, 2023

Type

pdf

Pages

7

Uploaded by ConstableGiraffeMaster829

Report
ECE360C: Algorithms Homework Assignment #1 University of Texas at Austin Due: September 1, 2023 (11:59pm) Homework Assignment #1 – Solutions Solutions are for individual use only by students registered for ECE 360C in Spring 2023 semester. They should not be otherwise shared or posted. Problem 1: Remember [20 points] Answer the following true/false questions about the Gale-Shapley algorithm. (We are using the version of Gale-Shapley described in class where n positions are offered to n applicants. The positions do the offering, and applicants simply accept the best offer they are made.) True False Every execution of the Gale-Shapley algorithm results in a stable matching of positions to applicants. In any execution of the Gale-Shapley algorithm, every applicant will end up with their least favored position. During the execution of the Gale-Shapley algorithm, once an applicant has been offered a position, they will always have some position. During the execution of the Gale-Shapley algorithm, once a position has been offered to at least one applicant, the position will always be matched to some applicant. Depending on the preference lists and the order in which offers are made, it is possible for some position to end up without a matched applicant. If an applicant and a position rank each other first, they are guaranteed to be matched by Gale-Shapley at the end of the algorithm. In some cases, even when the inputs to the algorithm are properly formed, the Gale-Shapley algorithm could get into an infinite loop of applicants and positions matching, then breaking the match, then matching again. The sequence of offers an applicant accepts is always improving (that is, an applicant never has to give up a good position for one the applicant ranks lower). If a position x makes an offer to applicant b after having made an offer to applicant a earlier in the algorithm, it must be true that x ranks a higher than b . The number of unfilled positions decreases by one for every iteration of the Gale-Shapley while loop.
Homework Assignment #1: September 1, 2023 (11:59pm) 2 Problem 2: Understand [20 points] In our discussion of the Gale-Shapley algorithm, we used the number of offers as a measure of progress and showed that each iteration of the while loop makes one new offer of a position to an applicant. Since there are n applicants and n positions, and an applicant can never be offered a position more than once, the while loop can be executed at most n 2 times. Consider a simple instance of Gale-Shapley, where n = 3 (there are 3 open positions, A , B , and C and 3 applicants X , Y , and Z ). Provide an example execution of Gale-Shapley that results in the maximum possible number of offers made (i.e., executions of the while loop). You will need to provide the complete preference list of all three positions and all three applicants as well as the order in which positions are offered to applicants. Also state whether your free list is a LIFO queue or a FIFO queue (that is, is a position that becomes open because an applicant took a better offer immediately offered their next favored applicant or do they go to the back of the line?). Finally, summarize at least three generic observations this exercise helps you make about the Gale-Shapley algorithm’s execution. We’ve done the first one for you. Positions’ Preference Lists A: X Y Z (given) B: Y X Z C: X Y Z Applicants’ Preference Lists X: B C A Y: C A B Z: A B C Type of Queue FIFO Initial Queue Order (include A, B, and C) A, B, C How many offers are made, in total? 7 Three Generic Observations (don’t refer to n = 3 or to specific applicants or positions) 1. It is not possible for all n positions to be offered to all n applicants. 2. There will always be at least one applicant who only receives one offer. 3. Regardless of the order in which offers are made, for a given set of preferences lists, the same offers are always made.
Homework Assignment #1: September 1, 2023 (11:59pm) 3 Problem 3: Apply [20 points] Read about this real world application of a Gale-Shapley-like algorithm: https://nyti.ms/3EevfRv Identify three similarities and three differences between the classic Gale-Shapley algorithm and the version described in the article. Two Similarities 1. The goal is the same – match two types of parties with the other based on preferences. 2. Both parties rank the other, and each individual has the option to rank based on their own preferences. Two Differences 1. There aren’t necessarily the same number of students and slots available. At least it doesn’t appear to be explicitly the case. 2. The applicants (and positions) don’t have to rank all of the other party Based on your knowledge of Gale-Shapley and your reading of this article, do you have any concerns or questions about how the matching algorithm works in this context? If so, write them here. If not, write “No concerns or questions.” (Finish this part of the question before moving on. It will be more interesting for you and for us.) My Questions and Concerns Lots of things are fine here. Now read these two additional articles about the process (note the dates on all three articles): https://nyti.ms/3KTO14w https://bit.ly/NYCPart3 If you have any trouble accessing these articles, please let us know ASAP.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help