The article links to another article [1] at the same site for a description of the stable marriage problem. I don't think the description is right.
Here is the description:
> Find a stable matching between two equally sized sets of elements where each element has a preference ranking of all the elements in the opposite set.
> A matching is stable if there are no unstable pairings.
> An unstable pairing happens in the following example:
> A and B from one set gets paired with 1 and 2 respectively from the other set. However, B prefers 1 and A prefers 2.
Let's arbitrarily call the lettered set the males and the numbered set the females.
That definition of an unstable pairing cannot possibly be correct, because it is defined entirely in terms of male preferences.
For a pairing to be unstable you need a male who prefers a different female, and you need that female to prefer him over her current male. Only then are they both willing to ditch the current partner to form the new pair.
A correct definition of unstable pairing must involved conditions on both male preferences and female preferences.
It should be something like this:
> A and B from one set gets paired with 1 and 2 respectively from the other set. However, B prefers 1 over 2 and 1 prefers B over A.
[1] https://www.arvarik.com/visiting-the-stable-marriage-problem