Algo-Phantoms / Algo-Tree

Algo-Tree is a collection of Algorithms and data structures which are fundamentals to efficient code and good software design. Creating and designing excellent algorithms is required for being an exemplary programmer. It contains solutions in various languages such as C++, Python and Java.
MIT License
363 stars 618 forks source link

[C++] [GSSoC'21] Stable Matching Problem - Gale Shapely Algorithm #592

Open parthmshah1302 opened 3 years ago

parthmshah1302 commented 3 years ago

Sample case: Input: A,B,C,D are the Students and p,q,r,s are the hospitals The preference of students are as follows: A:(p,q,r,s) B:{q,p,s,r} C:{q,s,r,p} D:{p,q,r,s}

The preference of hospitals are as follows: p:{A,C,B,D} q:{A,C,D,B} r:{D,B,A,C} s:{A,B,D,C}

Output: {(A,p),(B,s),(C,q),(D,r)} is a stable match (One can clearly see that there exists no student and hospital that would prefer each other more than their current match)

Note that this is not the only stable match.

I am a Participant of GSSoC'21, Can @rudrakshi99 @tarun26091999 @plazzy99 @nakul-19 @OjusWiZard @shreyanspoddar @raksha009 or any of the maintainers please assign me this issue in C++?

parthmshah1302 commented 3 years ago

Solved in #1520 Please review!