aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYigit Sever2020-11-06 05:22:38 +0300
committerYigit Sever2020-11-06 05:22:38 +0300
commit613bf0c79519036cff1cd04afa323e9fc37ac9a2 (patch)
tree58444e56014f44a63b044d5df850793265f0dc08
parentca2af8e5bf4f6523dde2f56a17426a01e40f7eba (diff)
downloadhw1-613bf0c79519036cff1cd04afa323e9fc37ac9a2.tar.gz
hw1-613bf0c79519036cff1cd04afa323e9fc37ac9a2.tar.bz2
hw1-613bf0c79519036cff1cd04afa323e9fc37ac9a2.zip
End commit for the thursday session
3 hours worth of work, two days till deadline
-rw-r--r--main.tex138
-rw-r--r--structure.tex16
2 files changed, 121 insertions, 33 deletions
diff --git a/main.tex b/main.tex
index 2676213..2803200 100644
--- a/main.tex
+++ b/main.tex
@@ -179,7 +179,7 @@ Whereas every college should arrange their preference list as;
179\section{Stable Matching Variation}% 179\section{Stable Matching Variation}%
180\label{sec:stable_matching_variation} 180\label{sec:stable_matching_variation}
181 181
182% stable matching question TODO {{{1 % 182% stable matching question ALMOST {{{1 %
183 183
184\begin{question} 184\begin{question}
185 Consider a Stable Matching problem with men and women. 185 Consider a Stable Matching problem with men and women.
@@ -188,24 +188,79 @@ Whereas every college should arrange their preference list as;
188 Either give a proof that shows such an improvement is impossible, or give an example preference list for which an improvement for $w$ is possible. 188 Either give a proof that shows such an improvement is impossible, or give an example preference list for which an improvement for $w$ is possible.
189\end{question} 189\end{question}
190 190
191TRUTH 191Example preference list for men; $M = {x,y,z}$ and women: $W = {a,b,c}$.
192Matching x with a (a) 192
193Matching y with b (a) 193\begin{table}[!htb]
194z is rejected by a because x is more preffered (c) 194 \caption{Preference lists of women.}
195z is rejected by b because y is more preffered (c) 195 \begin{minipage}{.5\linewidth}
196Matching z with c (a) 196 \caption{Everyone is being truthful}
197[('x', 'a'), ('y', 'b'), ('z', 'c')] 197 \centering
198 198 \begin{tabular}{l|lll}
199LIE 199 \textbf{a} & y & x & z \\
200 200 \textbf{b} & x & y & z \\
201Matching y with b (a) 201 \textbf{c} & x & y & z
202Matching z with a (a) 202 \end{tabular}
203x is rejected by a because z is more preffered (c) 203 \end{minipage}%
204Matching x with b, y is now free (b) 204 \begin{minipage}{.5\linewidth}
205Matching y with a, z is now free (b) 205 \centering
206z is rejected by b because x is more preffered (c) 206 \caption{a is lying about their preference}
207Matching z with c (a) 207 \begin{tabular}{l|lll}
208[('x', 'b'), ('y', 'a'), ('z', 'c')] 208 \textbf{a} & y & z & x \\
209 \textbf{b} & x & y & z \\
210 \textbf{c} & x & y & z
211 \end{tabular}
212 \begin{tikzpicture}[overlay]
213 \draw[red, line width=1pt] (-0.72,0.52) ellipse (0.70cm and 0.2cm);
214 \end{tikzpicture}
215 \end{minipage}
216\end{table}
217
218% TODO: final polish, highlight the lies <06-11-20, yigit> %
219
220\begin{table}[htb]
221 \centering
222 \begin{tabular}{l|lll}
223 \textbf{x} & a & b & c \\
224 \textbf{y} & b & a & c \\
225 \textbf{z} & a & b & c
226 \end{tabular}
227 \caption{The preference lists of the men.}%
228 \label{tab:men_pref}
229\end{table}
230
231The trace of \emph{Gale-Shapley} algorithm for the truth telling case;
232
233\begin{enumerate}
234 \item Matching x with a (a)
235 \item Matching y with b (a)
236 \item z proposes to a but gets rejected because a prefers x more (c)
237 \item z proposes to b but gets rejected because b prefers y more (c)
238 \item Matching z with c (a)
239\end{enumerate}
240
241\begin{align*}
242 x &\rightarrow a \\
243 y &\rightarrow b \\
244 z &\rightarrow c
245\end{align*}
246
247The trace of \emph{Gale-Shapley} algorithm when \emph{a} lies about their preferences;
248
249\begin{enumerate}
250 \item Matching y with b (a)
251 \item Matching z with a (a)
252 \item x proposes to a but gets rejected because a prefers z more (c)
253 \item Matching x with b, y is now free (b)
254 \item Matching y with a, z is now free (b)
255 \item z proposes to b but gets rejected because b prefers x more (c)
256 \item Matching z with c (a)
257\end{enumerate}
258
259\begin{align*}
260 x &\rightarrow b \\
261 y &\rightarrow a \\
262 z &\rightarrow c
263\end{align*}
209 264
210% 1}}} % 265% 1}}} %
211 266
@@ -371,18 +426,55 @@ Finally, picking $c2 > 2$ proves the conjecture.
371 426
372% 1}}} % 427% 1}}} %
373 428
374% question b FULL TODO {{{1 % 429% question b {{{1 %
375% TODO: haven't started yet <05-11-20, yigit> % 430% https://people.cs.umass.edu/~sheldon/teaching/cs311/hw/hw01.pdf
376 431
377\begin{question} 432\begin{question}
378 For each function $f(n)$ below, find (and prove that) (1) the smallest integer constant H such that $f(n) = \mathcal{O}(n^H)$, and (2) the largest positive real constant L such that $f(n) = \Omega(n^L)$. 433 For each function $f(n)$ below, find (and prove that)
379Otherwise, indicate that H or L do not exist. 434 \begin{enumerate}
435 \item the smallest integer constant H such that $f(n) = \mathcal{O}(n^H)$
436 \item the largest positive real constant L such that $f(n) = \Omega(n^L)$
437 \end{enumerate}
438 Otherwise, indicate that H or L do not exist.
380\end{question} 439\end{question}
381 440
382\begin{info}[] 441\begin{info}[]
383 $f(n) = \frac{n(n+1)}{2}$ 442 $f(n) = \frac{n(n+1)}{2}$
384\end{info} 443\end{info}
385 444
445(1) For $n_{0} \ge 1$; $\frac{n(n+1)}{2}$ is strictly smaller than $n^{2}$, yet $H=1$ is not possible since through the definition of Big-$\mathcal{O}$ notation it implies that for a \emph{constant} $c$;
446
447\begin{align*}
448 0 \le \frac{n(n+1)}{2} &\le c\cdot n \\
449 \frac{\cancel{n}(n+1)}{2} &\le c\cdot \cancel{n} \\
450 \frac{n+1}{2} &\cancel{\le} c
451\end{align*}
452
453Hence $f(n) = \mathcal{O}(n^{2})$ and $H=2$.
454
455% TODO: reread proof, strengthen? <06-11-20, yigit> %
456(2)$L=2$. We can pick the constant $c = \frac{1}{2}$ and write the Big-$\Omega$ notation;
457
458\begin{gather*}
459 c > 0 ~ \text{and} ~ n_{0} \ge 0 \\
460 \frac{n(n+1)}{2} \ge \frac{1}{2} n^{2} \\
461 \frac{\cancel{n}(n+1)}{\cancel{2}} \ge \frac{1}{\cancel{2}} n^{\cancel{2}} \\
462 n+1 \ge n
463\end{gather*}
464
465Does a $L>2$ work? Pick any $\ell > 2$;
466
467\begin{gather*}
468 c > 0 ~ \text{and} ~ n_{0} \ge 0 \\
469 \frac{n(n+1)}{2} \ge \frac{1}{2} n^{\ell} \\
470 \frac{n(n+1)}{\cancel{2}} \ge \frac{1}{\cancel{2}} n^{\ell} \\
471 n(n+1) \ge n^{\ell} \\
472 n+1 \ge n^{\ell - 1} \\
473 1 \ge n(n^{\ell - 2} - 1)
474\end{gather*}
475
476The final equation does not hold $n>1$ so $L>2$ cannot be true.
477
386\begin{info}[] 478\begin{info}[]
387 $f(n) = \sum^{\lceil{\log{n}}\rceil}_{k=0} \frac{n}{2^{k}}$ 479 $f(n) = \sum^{\lceil{\log{n}}\rceil}_{k=0} \frac{n}{2^{k}}$
388\end{info} 480\end{info}
diff --git a/structure.tex b/structure.tex
index e536c85..ae1765b 100644
--- a/structure.tex
+++ b/structure.tex
@@ -19,15 +19,20 @@
19% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS 19% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
20%---------------------------------------------------------------------------------------- 20%----------------------------------------------------------------------------------------
21 21
22\usepackage[utf8]{inputenc} % Required for inputting international characters
23\usepackage[T1]{fontenc} % Output font encoding for international characters
24\usepackage{csquotes}
22\usepackage{amsmath,amsfonts} % Math packages 25\usepackage{amsmath,amsfonts} % Math packages
23\usepackage{enumerate} % Custom item numbers for enumerations 26\usepackage{enumerate} % Custom item numbers for enumerations
24\usepackage[ruled]{algorithm2e} % Algorithms 27\usepackage[ruled]{algorithm2e} % Algorithms
28\usepackage[makeroom]{cancel}
25% \usepackage{algorithm} 29% \usepackage{algorithm}
26% \usepackage[noend]{algpseudocode} 30% \usepackage[noend]{algpseudocode}
27\usepackage[framemethod=tikz]{mdframed} % Allows defining custom boxed/framed environments 31\usepackage[framemethod=tikz]{mdframed} % Allows defining custom boxed/framed environments
28\usepackage{listings} % File listings, with syntax highlighting 32\usepackage{listings} % File listings, with syntax highlighting
29\usepackage[super]{nth} 33\usepackage[super]{nth}
30\usepackage{csquotes} 34\usepackage{caption}
35\usepackage{tikz}
31 36
32\lstset{ 37\lstset{
33 basicstyle=\ttfamily, % Typeset listings in monospace font 38 basicstyle=\ttfamily, % Typeset listings in monospace font
@@ -52,15 +57,6 @@
52} 57}
53 58
54%---------------------------------------------------------------------------------------- 59%----------------------------------------------------------------------------------------
55% FONTS
56%----------------------------------------------------------------------------------------
57
58\usepackage[utf8]{inputenc} % Required for inputting international characters
59\usepackage[T1]{fontenc} % Output font encoding for international characters
60
61% \usepackage{XCharter} % Use the XCharter fonts
62
63%----------------------------------------------------------------------------------------
64% COMMAND LINE ENVIRONMENT 60% COMMAND LINE ENVIRONMENT
65%---------------------------------------------------------------------------------------- 61%----------------------------------------------------------------------------------------
66 62