Matching with One-sided Preferences
We can suppose without loss of generality that the elements of $A$ have complete sets of preferences (if an element of $A$ is indifferent to some elements of $B$, we put them at the bottom of the element's preference list).

Our goal would be to match elements of $A$ and elements of $B$ such that the resulting matching is stable in the following sense. For any two elements $a_1,a_2 \in A$, either $a_1$ prefers its current match to that of $a_2$, or $a_2$ prefers its current match to that of $a_1$.

Here are two different algorithms for solving the problem. The first uses a greedy approach. Order the elements of $A$ arbitrarily: $A = a_1,\ldots,a_n$. Let $a_1$ choose its top pick, let $a_2$ choose the top available pick, and so on. This results in a stable matching since if $i &lt; j$ then $a_i$ prefers its current match to that of $a_j$.

A different approach, more similar to the Gale-Shapley algorithm, is iterative. Start with an arbitrary matching $f$. If there is a pair $a_1,a_2$ in which $a_1$ prefers $f(a_2)$ over $f(a_1)$ and $a_2$ prefers $f(a_1)$ over $f(a_2)$, then switch $f(a_1)$ and $f(a_2)$. This decreases the objective function $\Phi$ which is the sum over $i$ of the index of $f(a_i)$ in $a_i$'s preference list. Since $n \leq \Phi \leq n^2$ and $\Phi$ is an integer, we deduce that this algorithm terminates in $O(n^2)$ rounds.