Americas
Europe
Q61E
Expert-verifiedWrite the deferred acceptance algorithm in pseudocode.
is pair of women and their accepted proposals.
And return is for all
We will use ‘match’ algorithm.
Procedure match
Here is the proposal list of women .
Every man proposes to their preferred women and the women reject the proposal of all the men that are not their preferred man from the entire proposal. When the men will propose to the first women in their remaining preference list and the women will reject all the proposals of their no preferred men.
This will repeat until all women have exactly one remaining proposal.
For i : = 1 to n ,
While there exists a with such that
For j : = 1 to n
For k : = 1 to n
best =
For all do if p is preferred over best in then,
Else
Hence, is pair of women and their accepted proposals.
And return is for all
94% of StudySmarter users get better grades.
Sign up for free