Question: use java. implement a stack in array and use it to solve stable marriage problem. Description: In this project you will implement a stack and
Description: In this project you will implement a stack and use it to solve the stable marriage problem using backtracking. We will address the stable marriage problem in class along with backtracking. You are to explicitly use your stack to keep track of state in this implementation. Details: Input to this problem will come from a file. The file contains the number of pairings to make and two arrays indicating the preferences of each side. The input data will come from a file "ProjectiTestData.txt" and will be formatted as follows: /L number of pairings to make 4 Bobbie 0 1 2 3 Ted First person 's name in group A / Bob 's preferences (0 highest) second person 's name in groupA Gina 3 2 1 0 Harr 0 2 1 3 Mel 3 2 1 0 Barb 2 1 3 olive 2 3 10 Sam 2 0 1 3 Your program is to determine a pairing where there exist no two programmers that are not paired but would prefer each other to their actual partners. Your output upon finding a suitable pairing should be a list of the team pairs. First person 's name in group B /Mel's preferences C-highest) Team 0: Gina and Mel Team 1: Harry and Sam Team 2: Bobbie and olive Team 3: Ted and Barb If no such pairing exists you should output the message: No stable pairing exists. Program Guidelines . . . Your main program should be in a class named Project1. Your name should be in the comments at the top of each source file. Your variable names should be meaningful, they should reflect the usage or contents of the variable You should have Javadoc block comments for each class and non-trivial method
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
