Background: The Gale-Shapley Algorithm is useful for providing a single stable matching. The key word is...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Background: The Gale-Shapley Algorithm is useful for providing a single stable matching. The key word is single. One of the drawbacks with this algorithm despite its O(n) running-time is that it does not return every possible stable matching. Objective: Create a program that is able to take an instance of the Stable Matching Problem and return the total number possible stable matches. Input Format: You must create an input file called "input1.txt". You will then read from the file to obtain the following: How many men/women will there be? Each preference list for the men. Each preference list for the women. You will separate numbers in each list with a space (see examples below) For more understanding see the example #1 below. The 4 at the top of the file tells me there are 4 men and 4 women There are 8 total lines representing the preference lists The first 4 lines are the preference list for the men The last 4 lines are the preference list for the women EXAMPLE #1: Given an inputl.txt file of 4 1234 2134 3412 4312 2134 1234 4312 3412 Your output should be: 4 EXAMPLE #2: Given an inputl.txt file of 2 12 12 12 12 Your output should be: 1 Important Note: This project will be computationally intensive since it will have a worst case running time of O(n!). You can use the examples to check your program. I expect your program to be able to handle 10 men and women. If your program fails to hit this mark you will lose points. Background: The Gale-Shapley Algorithm is useful for providing a single stable matching. The key word is single. One of the drawbacks with this algorithm despite its O(n) running-time is that it does not return every possible stable matching. Objective: Create a program that is able to take an instance of the Stable Matching Problem and return the total number possible stable matches. Input Format: You must create an input file called "input1.txt". You will then read from the file to obtain the following: How many men/women will there be? Each preference list for the men. Each preference list for the women. You will separate numbers in each list with a space (see examples below) For more understanding see the example #1 below. The 4 at the top of the file tells me there are 4 men and 4 women There are 8 total lines representing the preference lists The first 4 lines are the preference list for the men The last 4 lines are the preference list for the women EXAMPLE #1: Given an inputl.txt file of 4 1234 2134 3412 4312 2134 1234 4312 3412 Your output should be: 4 EXAMPLE #2: Given an inputl.txt file of 2 12 12 12 12 Your output should be: 1 Important Note: This project will be computationally intensive since it will have a worst case running time of O(n!). You can use the examples to check your program. I expect your program to be able to handle 10 men and women. If your program fails to hit this mark you will lose points.
Expert Answer:
Answer rating: 100% (QA)
Background The GaleShapley Algorithm is useful for providing ... View the full answer
Related Book For
Data Structures and Algorithm Analysis in Java
ISBN: 978-0132576277
3rd edition
Authors: Mark A. Weiss
Posted Date:
Students also viewed these programming questions
-
How do supporters of globalization argue that it does not harm labor standards, environmental regulations, and future markets?
-
Rewrite the SideEffect program from this section so that it does not contain any side effects. Rather than modifying a global variable, make the function accept the value of x to use as a parameter.
-
Find the limit or show that it does not exist. lim lim lim
-
I t was Swiss hotelier Csar Ritz, founder of the Parisian Htel Ritz back in 1898, who coined the familiar phrase the customer is always right. For the modern hospitality manager who must constantly...
-
In March 2014, Grackle, Inc., acquired used equipment for its business at a cost of $300,000. The equipment is five-year class property for regular income tax purposes and for AMT purposes. Grackle...
-
The following data are taken from the comparative balance sheet prepared for Route 13 Company. Sales for Year 2 were $1,250,000. Sales for Year 1 were $800,000. 1. Prepare a common-size balance sheet...
-
Consider the output of a regression using one explanatory variable on \(n=3\) observations. The residuals and leverages are: Compute the PRESS statistic. i 1 2 3 Residuals ei Leverages hi 3.181...
-
The ANES in 2012 asked respondents to state their ages stored as AGE. a. Calculate the mean, variance, and standard deviation. b. Draw a histogram. c. Use the Empirical rule, if applicable, or...
-
Heather Smith Cosmetics (HSC) manufactures a variety of products and is organized into three divisions (investment centers): soap products, skin lotions, and hair products. Information about the most...
-
Target Corporation prepares its financial statements according to U.S. GAAP. Targets financial statements and disclosure notes for the year ended February 3, 2018, are available in Connect. This...
-
BARGAINING PRICE WITH THE CHINESE BY DR ROB MARCH K. G. Marwin Inc. developed a particular technology in the 1980s, called the Trilliamp Process, that the Chinese government sought to integrate into...
-
identify which are media and which are information assets: Traverse Accounting Software provides the following applications: General Ledger Accounts Payable Accounts Receivable Payroll (Employee...
-
Winning the Best Entrepreneur Award for 2017 gave Othman and his team the boost to innovate further. They have also participated in exhibitions locally and internationally from London to China. Asked...
-
Identify the limitations that may be imposed in a variable interest entity. how these limitation be imposed?
-
What does accounts recieveable turnover show about how efficiently a company manages its assets?
-
What is the Expected Return of Portfolio Fund A, using the weighted average method?
-
3. What do you think is the maximum price* Virgin can charge per minute? What is the LTV for that price? Consider what the market or customers are willing to pay - look in the case for information to...
-
Medi-Exam Health Services, Inc. (MEHS), located in a major metropolitan area, provides annual physical screening examinations, including a routine physical, EKG, and blood and urine tests. MEUS's...
-
Using the quicksort implementation in this chapter, determine the running time of quicksort for a. Sorted input b. Reverse-ordered input c. Random input
-
Add support for a ListIterator to the MyLinkedList class, as was done in Exercise 3.13. Add support for a ListIterator to the MyArrayList class. The ListIterator interface in java.util has more...
-
Suppose we want to add the decreaseAllKeys() operation to the heap repertoire. The result of this operation is that all keys in the heap have their value decreased by an amount . For the heap...
-
What is the change in velocity of \((a)\) cart 1 (b) cart 2 in Figure 4.6? (c) What do you notice about your two answers? Figure 4.6 Velocity-versus-time graph for two identical carts before and...
-
(a) Are the accelerations of the motions shown in Figure 4.1 constant? (b) For which surface is the acceleration largest in magnitude? Figure 4.1 Velocity-versus-time graph for a wooden block sliding...
-
The \(x\) component of the final velocity of the standard cart in Figure 4.8 is positive. Can you make it negative by adjusting this cart's initial speed while still keeping the half cart initially...
Study smarter with the SolutionInn App