Gale-Shapley algorithm for stable matching in C++ from College Admissions and the Stability of Marriage paper by Gale, D.; Shapley, L. S. (1962)
Create a stable matching, where there is no pair that prefers each other to their current partner under the matching. Requires two equally sized sets of elements and a complete an ordering of preferences for each element.