Question: I want correct executable code in python. Input Format: First line: Two integers M and W , the number of men and women respectively. Next

I want correct executable code in python.\ Input Format:\ First line: Two integers

M

and

W

, the number of men and women respectively.\ Next

M

lines: Each line consisting of a preference list of a man.\ Following W lines: Each line consisting of a preference list of a woman.\ Example Input (input1.txt):\ 32\ m1 w1 w2\

m2

w2 w1\ m3 w1 w2\ w1

m1m2m3

\ w2

m2m1m3

\ Output Format:\ Output must be written to files named output.txt, output1.txt, output2.txt, ..., outputN.txt, respectively\ (whose name you can generate automatically) detailing the stable matches for the corresponding\ input.

 I want correct executable code in python.\ Input Format:\ First line:

I want correct executable code in python. Input Format: First line: Two integers M and W, the number of men and women respectively. Next M lines: Each line consisting of a preference list of a man. Following W lines: Each line consisting of a preference list of a woman. Example Input (input1.txt): 32 m1w1w2 m2w2w1 m3w1w2 w1m1m2m3 w2m2m1m3 Output Format: Output must be written to files named output.txt, output1.txt, output2.txt, .., outputN.txt, respectively (whose name you can generate automatically) detailing the stable matches for the corresponding input

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres a Python code implementing the GaleShapley algorithm to solve the stable marriage problem This code reads from input1txt and outputs the match r... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!