Question
A company has hired N interns to each join one of N different teams. Each intern has ranked their preferences for which tearns they wish
A company has hired N interns to each join one of N different teams. Each intern has ranked their preferences for which tearns they wish to join and each team has ranked their preferences for which interns they prefer, Given these preferences, assign 1 intern to each tear. These assignments should be "stable," meaning that there is no unmatched pair of an intern and a team such that both that intern and that team would prefer they be matched with each other. In the case there are multiple valid stable matchings, the solution that is most optimal for the interns should be chosen (ie, every intern should be matched with the best team possible for them). Your function should take in 22-dimensional lists, one for interns and one for teams. Each inner list represents a single intern or team's preferences, ranked from most preferable to least preferable. These lists will always be of length N, with integers as elements. Each of these integers corresponds to the index of the team/intern being ranked. Your function should return a 2-dimensional list of matchings in no particular order. Each matching should be in the format (internindex, teamIndex] Sample input: "interns":[ 20, 1, 21, 12.1 01. 11.2.011. "teams": [[2.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started