Write the output after explicitly checking to see match

Assignment Help Data Structure & Algorithms
Reference no: EM132374777

Assignment

1) Do Problem 4 in Chapter 1 on Pages 23-24 of the Kleinberg and Tardos text.

Problem 4. Gale and Shapley published their paper on the Stable Matching Problem in 1962; but a version of their algorithm had already been in use for ten years by the National Resident Matching Program, for the problem of assigning medical residents to hospitals.

Basically, the situation was the following. There were rn hospitals, each with a certain number of available positions for hiring residents.
There were tz. medical students graduating in a given year, each interested in joining one of the hospitals. Each hospital had a ranking of the students in order of preference, and each student had a ranking of the hospitals in order of preference. We will assume that there were more students graduating than there were slots available in the m hospitals.

The interest, naturally, was in finding a way of assigning each student to at most one hospital, in such a way that all available positions in all hospitals were filled. (Since we are assuming a surplus of students, there would be some students who do not get assigned to any hospital.) We say that an assignment of students to hospitals is stable if neither of the following situations arises.

• First type of instability: There are students s and s', and a hospital h,
so that

- s is assigned to tt, and
- s' is assigned to no hospital, and
- it prefers s' to s.

• Second type of instability: There are students s and s', and hospitals

It and le , so that

- s is assigned to h., and
- s' is assigned to le , and
- h prefers s' to s, and
- s' prefers h to h'.

So we basically have the Stable Matching Problem, except that (i) hospitals generally want more than one resident, and (ii) there is a surplus of medical students.

Show that there is always a stable assignment of students to hospitals, and give an algorithm to find one.

Specifically, implement Gale-Shapley Algorithm for computing the hospitals-residents matching Assignment in Python (or Java) using the approach and data structures described in the first two Chapters of Kleinberg and Tardos text (and reviewed in class).

Specifically, consider the residents as the “proposers” and the hospitals as the “disposers”. Note also that a hospital can have a number of slots and not all residency applicants will get a position. Watch the following video explaining the algorithm:

How the NRMP Matching Algorithm Works. (Youtube)

In your solution, make sure to:

(a) Assume that the input for an n-hospitals-m-residents problem is provided as a sequence of (n+1+m)-lines (encoding the preference lists – n lines for hospitals and m lines for residents with one empty line to separate the hospitals from residents) with each comma-separated line formatted as follows:

HOSPITAL_1, SLOTS, RESIDENT_a, …

**BLANK LINE**
RESIDENT_1, HOSPITAL_x, HOSPITAL_y, …


For example:
MERCY, 2, DARRIUS, JOSEPH
CITY, 2, DARRIUS, ARTHUR, SUNNY, LATHA, JOSEPH

ARTHUR, CITY
SUNNY, CITY, MERCY


For each hospital, we give the hospital name/id, the number of slots, and the preference list of residents. For each resident, we provide the resident id/name and the preference list of hospitals.

(b) Write the output after explicitly checking to see that it is a stable match. Note that writing and running a stability checker is a good debugging aid. When you turn in your solution, do include sample inputs and corresponding outputs in a separate file. Format the output as follows showing the matching of residents to hospitals:

HOSPITAL_1, RESIDENT_11, RESIDENT_12
HOSPITAL_2, RESIDENT_21, RESIDENT_22


(c) In your program, include pseudo-code of the modified Gale Shapley algorithm as a comment.

2) Do Problem 4 in Chapter 2 on Pages 67-68 of the Kleinberg and Tardos text. Justify your ordering of the growth rate functions in each case.

Reference no: EM132374777

Questions Cloud

Time required for speedy lube finish : The time required for Speedy Lube finish an oil change service on an automobile approximately follows a normal distribution, with mean of 17 minutes
What are the differences between sarcasm-irony and satire : You formulate your response to "The Science of Sarcasm" by Richard Chin. What are the differences between sarcasm, irony and satire?
How does being humble help a business owner : How does being humble help a business owner? How does not being able to take criticism hinder a business owner?
The story is full of fantastic imagery : The story is full of fantastic imagery. Identify some of your favorites and explain how those images support a major theme of the story.
Write the output after explicitly checking to see match : WRIGHT STATE UNIVERSITY- CS7200-Algorithm Design and Analysis-USA-Write the output after explicitly checking to see that it is a stable match.
Structure of organizations and the role of the ceo : How being accountable to the stock market has influenced the structure of organizations and the role of the CEO.
Write several pages of a detailed analysis or prose : The ability to summarize a salient point is every bit as important to a Ph.D. as being able to write several pages of a detailed analysis or prose.
Project cost management : Project Cost Management. Why do you think it's difficult to understand some of the basic cost terms in this chapter?
Discuss nike from a strategic perspective : Information concerning recent changes in the firm is readily available online and should be accessed. Strategic issues should be discussed in "real time."

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Develop a searching algorithm that looks for a key

Develop a searching algorithm that looks for a key in this list. What major factor(s) should be considered when an external search algorithm is developed?

  What is the role of data models in database design

What is data integrity, and what is the significance of a lack of data integrity? Define data independence. What is the role of data models in database design?

  What is z-buffer algorithm?

What is z-buffer algorithm?

  Explain function and internal structure of program module

Explain Function and internal structure of each program module. Complete the Visual Logic flowchart that represents the algorithm.

  What problems come up in verifying this function

How many recursive calls are made by the following initial calls?

  Determine if array is unique and in ascending order

I need to determine if my array is unique and in ascending order. I've got the ascending order part figured out but am not sure that I'm doing the unique part correctly. Could you check my pseudocode to see if I have it right? I not, please give m..

  What is sequence of numbers in a after first partition

what is sequence of numbers in A after first partition (by calling Partition(A, 1, 9))? Note that 1 and 9 in Partition(A, 1, 9) function call are array indexes.

  Research on algorithms flowcharts and pseudocodes

Using the Internet, further research on the following: Algorithms, Flowcharts, Pseudocodes

  Write linear-time sorting algorithm that sorts a permutation

Write a linear-time sorting algorithm that sorts a permutation of integers 1 through n, inclusive.

  Computing randomized quick sort-s running time

Suppose that all element values are equal. What would be randomized quick sort's running time in this case? Each element of A[p .. q-1] is less than A[q], and each element of A[t+1 .. r] is greater than A[q]

  Store the grades that you read in an arraylist

We expect the file to contain grades represented by integer values, one per line. If you encounter a value that is not an integer, you should throw an exception, print a message to the console, skip that value, and continue processing.

  Analyze an algorithm that finds the smallest numbers

CS 6033: Design and Analysis of Algorithms - New York University - Design and analyze an algorithm that finds both the smallest and the second smallest numbers

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd