Gale–Shapley algorithm

"The stable matching problem, in its most basic form, takes as input equal numbers of two types of participants (n men and n women, or n medical students and n internships, for example), and an ordering for each participant giving their preference for who to be matched to among the participants of the other type. A matching is not stable if:

There is an element A of the first matched set which prefers some given element B of the second matched set over the element to which A is already matched, and
B also prefers A over the element to which B is already matched.

In other words, a matching is stable when there does not exist any match (A, B) which both prefer each other to their current partner under the matching. A stable matching always exists, and the algorithmic problem solved by the Gale–Shapley algorithm is to find one." - Wikipedia


Kommentarer

Populära inlägg