CS计算机代考程序代写 algorithm oh

oh

04

OG

OG

Get put
Array 011 04
queue 04 OCI
stack 04 Oci
linked list 047 OCI

keep an array N
t where

NextCm points to thepositions ofthe next woman he will beproposigto
on his pref Est

Man Pref m NextEMT

I
takes 04

keep an array
called currentG n

where current w is No11 if w issingle
setto w is engaged to me

takes 0 i

womanPrep t
12 34502

womanRanting
2 3 5 6

Men’s ID’s
A

Propagation
G.si enatais overall
OCn2 0Cn2

1
w

E

infavor
of m

5 To
i r

M o o w
l

I

S m W

M oh o w

Discussion 1

1. Prove that every execution of the G-S algorithm (when men are proposing) results in the
same stable matching regardless of the order in which men propose.

2. Prove that when we run the G-S algorithm with men proposing, women end up with their

worst valid partners.

3. True or False:
In every stable matching that Gale–Shapley algorithm may end up with when men propose,
there is a man who is matched to his highest-ranked woman.

4. In a connected bipartite graph, is the bipartition unique? Justify your answer.