From 237497c0c34bd979c6a05d03249c6a973727cbc9 Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 25 Apr 2024 14:59:29 -0700 Subject: [PATCH] Finished compression handout --- Advanced/Compression/main.tex | 4 +++ Advanced/Compression/media/box.png | Bin 4543 -> 0 bytes Advanced/Compression/media/noise.png | Bin 5630 -> 0 bytes Advanced/Compression/parts/1 runlength.tex | 7 +++- Advanced/Compression/parts/3 huffman.tex | 5 ++- Advanced/Compression/parts/4 bonus.tex | 40 +++++++++++++++++++++ 6 files changed, 52 insertions(+), 4 deletions(-) delete mode 100644 Advanced/Compression/media/box.png delete mode 100644 Advanced/Compression/media/noise.png create mode 100644 Advanced/Compression/parts/4 bonus.tex diff --git a/Advanced/Compression/main.tex b/Advanced/Compression/main.tex index 4630322..1c9367b 100755 --- a/Advanced/Compression/main.tex +++ b/Advanced/Compression/main.tex @@ -8,12 +8,15 @@ \input{tikzset.tex} \usepackage{units} +\usepackage{pdfpages} \uptitlel{Advanced 2} \uptitler{\smallurl{}} \title{Compression} \subtitle{Prepared by Mark on \today{}} +% TODO: add a section on info theory, +% shannon entropy. etc. \begin{document} @@ -23,5 +26,6 @@ \input{parts/1 runlength.tex} \input{parts/2 lzss.tex} \input{parts/3 huffman.tex} + \input{parts/4 bonus.tex} \end{document} \ No newline at end of file diff --git a/Advanced/Compression/media/box.png b/Advanced/Compression/media/box.png deleted file mode 100644 index 42cb086cb521d5aad496cf878bc53b4b142bc8db..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4543 zcmeHLdu$X%7~iASVzm`(D+DpFOArzF_IbB=Ymc_}N_)aVEd`2TWFNEb(%$WLZ`)pp z4@AWWK6nTLtOg^3AweZTB!VDOM8pR%;EM#CA`xR0jmDx7@teJCdyOWhiTu~So158h ze)F4ee)G+DxA#QtjOv2?vH1i+6hvymbx@b%GV*fx+-kO-gz6}2h!~N`t;9&U0i-9F z@L&uSPgZ+`Cx^%Z+cGFc(8d^C#(FMu>!+Z7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Z3;aB$alg zyM6*!x=U+P;*AKhM6Of}jQ^!_a)RARwL=C4-|Cl@HKtP!A%(;91284rWhU zhSQc1g#)E-ES!J7I&j24Muk~A-oG97|r507L4`Fyp$1)x%5la4c)K$Rf*PA zq|jmj&WeHrp7sXCF1X9SgsornI)DoI4$;VYAN%NZBGNT@+e4?wn2V| zbkFqX`;2BdvtGh06K zio*}R4tO5)`bX}7XUWUeY1LukB7SXrd&_FDT#=}mmn4WQuf@efZ0H&T#ylqyt;#!- zn_E;^c&wouma{Z>r$~$^fWJ7huZ8nR$G^Pn!J=h#A7XQ)YDW0AI~Fee E8@#~gxBvhE diff --git a/Advanced/Compression/media/noise.png b/Advanced/Compression/media/noise.png deleted file mode 100644 index 8b6dee648b56ad23ba29f74fbe5de02165ee1534..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5630 zcmeHKdpMNa8lOoviM^ddu~TzKD4P3yGNp{o#7IVkRKA({hA-yAj9aCobkU9IMpQ!R zauW7d#8#4&3~VD%=YoQ48y>3^*y>AH zb2|e|&HTA`;_=-vWITz8r_g~vkxXS1)gKIr#3nM>6c#|EkA0bunyJvZ{S#o>f;c$1 z^Bf#7iV(R334&3mh$B%69Oogh?-4^l-wGwuHU?eXNr385rs**ZhSO z>>H$%#6@uz26OKY#2H3y*2Q2cHx4CcP}leLqeVBE4isGVj?%Re01J}b}bnJ{yw_r1pLCwGW) zvjnB_{a&3VSG`X)dk-8L+}ajXdj4jp&k1MfA1?8jg$vA$Js}IXjj2WxP46%M@XpD% zjEj%;H7174Irf9W`5v8(n;+#D#t9Nvc`zruDPi8aHuZM#!~(ND{ZY@EXC`Cb>HBt@ zZ#*;M=7xQ(T>*I(ettg}74-#FPgh*f(w}d7es-}(`~mkl<6ii`agFrrGU-~~|FpUF zTDMkwrgx@1db5LH3HM&lyg&PT(pt(mz3)Gw(1jt9tXe}`5Q7njr?ACYmeFN({s7(~p$E~oK{e1!uXfH0i2B=gDHh~Zx9*z&E;N>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~bvHhvg;XGa^I%q~i z(`&sb^Q#XHtyZtzr6&-(v{)QEn^zZaa%M06PIt<@m{UVbU0Ul@`At@~V$bbCcqdlw kt~{sS{SS?rU#%ZPuU5(mnptUAK;}mA9NoBQ7y8Bg2VU1%(*OVf diff --git a/Advanced/Compression/parts/1 runlength.tex b/Advanced/Compression/parts/1 runlength.tex index fa4fc68..e8c6e8f 100644 --- a/Advanced/Compression/parts/1 runlength.tex +++ b/Advanced/Compression/parts/1 runlength.tex @@ -35,7 +35,7 @@ \problem{} -Using a na\"ive coding scheme, encode \texttt{AAAA$\cdot$AAAA$\cdot$BCD$\cdot$AAAA$\cdot$AAAA} in binary. \par +Using the na\"ive coding scheme, encode \texttt{AAAA$\cdot$AAAA$\cdot$BCD$\cdot$AAAA$\cdot$AAAA} in binary. \par \note[Note]{ We're still using the four-symbol alphabet $\{\texttt{A}, \texttt{B}, \texttt{C}, \texttt{D}\}$. \par Dots ($\cdot$) in the string are drawn for readability. Ignore them. @@ -44,6 +44,11 @@ Using a na\"ive coding scheme, encode \texttt{AAAA$\cdot$AAAA$\cdot$BCD$\cdot$AA \begin{solution} There are eight \texttt{A}s on each end of that string. Mapping symbols as before, \par we get \texttt{[00 00 00 00 00 00 00 00 01 10 11 00 00 00 00 00 00 00 00]} + + \begin{instructornote} + In this handout, all encoded binary is written in square brackets. \par + Spaces, dashes, dots, and etc are added for readability, and should be ignored. + \end{instructornote} \end{solution} diff --git a/Advanced/Compression/parts/3 huffman.tex b/Advanced/Compression/parts/3 huffman.tex index c264152..0a15c7e 100644 --- a/Advanced/Compression/parts/3 huffman.tex +++ b/Advanced/Compression/parts/3 huffman.tex @@ -3,7 +3,7 @@ \example{} Now consider the alphabet $\{\texttt{A}, \texttt{B}, \texttt{C}, \texttt{D}, \texttt{E}\}$. \par -With a na\"ive coding scheme, we can encode a length $n$ string with $3n$ bits, by mapping... +With the na\"ive coding scheme, we can encode a length $n$ string with $3n$ bits, by mapping... \begin{itemize} \item $\texttt{A}$ to $\texttt{000}$ \item $\texttt{B}$ to $\texttt{001}$ @@ -12,8 +12,7 @@ With a na\"ive coding scheme, we can encode a length $n$ string with $3n$ bits, \item $\texttt{E}$ to $\texttt{100}$ \end{itemize} For example, this encodes \texttt{ADEBCE} as \texttt{[000 011 100 001 010 100]}. \par -To encode strings over $\{\texttt{A}, \texttt{B}, \texttt{C}, \texttt{D}, \texttt{E}\}$ with this scheme, we -need an average of three bits per symbol. +It is easy to see that this scheme uses an average of three bits per symbol. \vspace{2mm} diff --git a/Advanced/Compression/parts/4 bonus.tex b/Advanced/Compression/parts/4 bonus.tex new file mode 100644 index 0000000..415fd7c --- /dev/null +++ b/Advanced/Compression/parts/4 bonus.tex @@ -0,0 +1,40 @@ +\section{Bonus problems} + + +\problem{} +Make sense of the document on the next page. \par +What does it describe, and how does it work? + + +\problem{} +Given a table with a marked point, $O$, and with $2013$ properly working watches put down on the table, prove that there exists a moment in time when the sum of the distances from $O$ to the watches' centers is less than the sum of the distances from $O$ to the tips of the watches' minute hands. + +\vfill + + +\problem{A Minor Inconvenience} +A group of eight friends goes out to dinner. Each drives his own car, checking it in with valet upon arrival. +Unfortunately, the valet attendant forgot to tag the friends' keys. Thus, when the group leaves the restaurant, +each friend is handed a random key. +\begin{itemize} + \item What is the probability that everyone gets the correct set of keys? + \item What is the probability that each friend gets the wrong set? +\end{itemize} + +\vfill + + +\problem{Bimmer Parking} +A parking lot has a row of 16 spaces, of which a random 12 are taken. \par +Ivan drives a BMW, and thus needs two adjacent spaces to park. \par +What is the probability he'll find a spot? + +\vfill +\pagebreak + +\includepdf[ + pages=1, + fitpaper=true +]{parts/qoi-specification.pdf} + +\pagebreak \ No newline at end of file