diff options
author | Yigit Sever | 2020-11-06 22:23:40 +0300 |
---|---|---|
committer | Yigit Sever | 2020-11-06 22:27:30 +0300 |
commit | c36174beb18a6afe2d7ccb8b6dd2803bd898a1a2 (patch) | |
tree | 82ca095841e4e8a7538573a5241e8928dbc957f1 | |
parent | 613bf0c79519036cff1cd04afa323e9fc37ac9a2 (diff) | |
download | hw1-c36174beb18a6afe2d7ccb8b6dd2803bd898a1a2.tar.gz hw1-c36174beb18a6afe2d7ccb8b6dd2803bd898a1a2.tar.bz2 hw1-c36174beb18a6afe2d7ccb8b6dd2803bd898a1a2.zip |
Polish the answer of 1.d
-rw-r--r-- | main.tex | 40 |
1 files changed, 22 insertions, 18 deletions
@@ -39,7 +39,6 @@ | |||
39 | \end{question} | 39 | \end{question} |
40 | 40 | ||
41 | \begin{commandline}[Gale-Shapley algorithm, from lecture slides, edited for the context] | 41 | \begin{commandline}[Gale-Shapley algorithm, from lecture slides, edited for the context] |
42 | |||
43 | \begin{verbatim} | 42 | \begin{verbatim} |
44 | Initialize each person to be free. | 43 | Initialize each person to be free. |
45 | while (some student is free and hasn't applied to every college) { | 44 | while (some student is free and hasn't applied to every college) { |
@@ -53,7 +52,6 @@ | |||
53 | c rejects m (c) | 52 | c rejects m (c) |
54 | } | 53 | } |
55 | \end{verbatim} | 54 | \end{verbatim} |
56 | |||
57 | \end{commandline} | 55 | \end{commandline} |
58 | 56 | ||
59 | A quick trace of the algorithm; | 57 | A quick trace of the algorithm; |
@@ -124,33 +122,39 @@ $S'$ could not have occurred since men propose in accordance to their preference | |||
124 | 122 | ||
125 | % 1}}} % | 123 | % 1}}} % |
126 | 124 | ||
127 | % question d TODO {{{1 % | 125 | % question d ✅ {{{1 % |
128 | 126 | ||
129 | \begin{question} | 127 | \begin{question} |
130 | Give an instance of $n$ colleges, $n$ students, and their preference lists so that the Gale-Shapley algorithm requires only $O(n)$ iterations, and prove this fact. | 128 | Give an instance of $n$ colleges, $n$ students, and their preference lists so that the Gale-Shapley algorithm requires only $O(n)$ iterations, and prove this fact. |
131 | \end{question} | 129 | \end{question} |
132 | 130 | ||
133 | % TODO: you abused n and now they're both fucked <05-11-20, yigit> % | 131 | For a proposer agnostic formation, arrange the preference lists of colleges and students as follows; |
134 | 132 | ||
135 | Arrange the preference lists such as every $m^{\text{th}}$ student arranges their preference list such as; | 133 | \begin{gather*}% |
136 | |||
137 | \begin{equation} | ||
138 | \label{eq:student_prefs} | 134 | \label{eq:student_prefs} |
139 | C_n, C_{n-1}, C_{n-2}, \dots, C_{1} | 135 | C_{1} \rightarrow \left\{ S_{1}, S_{n}, S_{n-1}, \dots, S_{2} \right\} \\ |
140 | \end{equation} | 136 | C_{2} \rightarrow \left\{ S_{2}, S_{n}, S_{n-1}, \dots, S_{3} \right\} \\ |
137 | \dots \\ | ||
138 | C_{k} \rightarrow \left\{ S_{k}, S_{n}, S_{n-1}, \dots, S_{k+1} \right\} \\ | ||
139 | \dots \\ | ||
140 | C_{n} \rightarrow \left\{ S_{n}, S_{n-1}, S_{n-2}, \dots, S_{1} \right\} \\ | ||
141 | \end{gather*} | ||
141 | 142 | ||
142 | Whereas every college can arrange their preference list as; | 143 | \begin{gather*}% |
144 | \label{eq:student_prefs} | ||
145 | S_{1} \rightarrow \left\{ C_{1}, C_{n}, C_{n-1}, \dots, C_{2} \right\} \\ | ||
146 | S_{2} \rightarrow \left\{ C_{2}, C_{n}, C_{n-1}, \dots, C_{3} \right\} \\ | ||
147 | \dots \\ | ||
148 | S_{k} \rightarrow \left\{ C_{k}, C_{n}, C_{n-1}, \dots, C_{k+1} \right\} \\ | ||
149 | \dots \\ | ||
150 | S_{n} \rightarrow \left\{ C_{n}, C_{n-1}, C_{n-2}, \dots, C_{1} \right\} \\ | ||
151 | \end{gather*} | ||
143 | 152 | ||
144 | \begin{equation} | 153 | Where the student list $\{S_1, S_2, \dots, S_{n}\}$ and college list $\{C_1, C_2, \dots, C_{n}\}$ are shifted. |
145 | \label{eq:college_prefs} | ||
146 | S_n, S_{n-1}, S_{n-2}, \dots, S_{1} | ||
147 | \end{equation} | ||
148 | 154 | ||
149 | The arrangement in (\ref{eq:college_prefs}) is not crucial since no college will be given a chance to \enquote{trade up}. | 155 | In this setup, ever proposer will propose to the first suitor in their preference list which is guaranteed to be free since they are not the first on any other suitor's preference list. |
150 | 156 | ||
151 | Every proposer applies to colleges in decreasing order from their preference list. | 157 | The algorithm in this instance runs in $\mathcal{O}(n)$ iterations, every proposer will follow the (a) branch in the algorithm given under Question~\ref{q:1_a}. |
152 | For $n=1$, $S_1$ applies to $C_1$ and the algorithm terminates in $n=1$ steps. | ||
153 | For $n=k$, $S_1$ applies to $C_1$ which is free, $S_2$ applies to $C_2$ which is again free up to $S_k$ which can freely apply to $C_k$ and the algorithm terminates in $k$ steps after every student applied to the college on top of their preference list which was guaranteed to be free. | ||
154 | 158 | ||
155 | % 1}}} % | 159 | % 1}}} % |
156 | 160 | ||