When there are no such pairs of people, the set of matching algorithm dating is deemed stable. Algorithms for finding solutions to the stable marriage problem have applications in a variety of real-world situations, perhaps the best known of these being in the assignment of graduating medical students to their first hospital appointments.
SMP and make all marriages stable. She is then provisionally “engaged” to the suitor she most prefers so far, and that suitor is likewise provisionally engaged to her. This process is repeated until everyone is engaged. Let Alice and Bob both be engaged, but not to each other.
Upon completion of the algorithm, it is not possible for both Alice and Bob to prefer each other over their current partners. If Bob prefers Alice to his current partner, he must have proposed to Alice before he proposed to his current partner. If Alice accepted his proposal, yet is not married to him at the end, she must have dumped him for someone she likes more, and therefore doesn’t like Bob more than her current partner. If Alice rejected his proposal, she was already with someone she liked more than Bob. While the solution is stable, it is not necessarily optimal from all individuals’ points of view. The traditional form of the algorithm is optimal for the initiator of the proposals and the stable, suitor-optimal solution may or may not be optimal for the reviewer of the proposals. All three are stable because instability requires one of the participants to be happier with an alternative match.