Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

Write the deferred acceptance algorithm in pseudocode.

Short Answer

Expert verified

Pa,wais pair of women and their accepted proposals.

And return isPa,wa for alla1,2,...,n

Step by step solution

01

Step 1:

We will use ‘match’ algorithm.

Procedure match

m1,m2,,mn,w1,w2,.,wnwith preference listsM1,M2,Mn,W1,W2,Wn,respectively)

Herepi is the proposal list of womenwi .

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.

02

Step 2:

For i : = 1 to n ,

Pi:=ϕ

While there exists aPi withi1,2,...,n such thatPi:=ϕ

For j : = 1 to n

PMi1:=PMi1Mj

For k : = 1 to n

best =pk1

03

Step 3

For all pPkdo if p is preferred over best inWk then,

Mbest:=Mbest-wk

Else

Mp:=Mp-wk

Hence,Pa,wa is pair of women and their accepted proposals.

And return isPa,wa for alla1,2,...,n

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Study anywhere. Anytime. Across all devices.

Sign-up for free