\documentclass[12pt]{article} 

%%%%%%% a few packages
\usepackage{todonotes} 
\usepackage{tikz} % for drawing pictures; not all libraries needed
\usetikzlibrary{decorations,patterns,snakes,calc,chains,shapes.multipart,arrows,positioning,shapes,automata,fit,shadows,arrows.meta,trees}
\usepackage{xcolor,colortbl}  % needed to color table entries

\newif\ifspace% there are some spacing comments so you can see an expected
\spacetrue    % length of answer.  If you switch which of this and the next
%\spacefalse  % line are commented out then the space gets added/disappears.

\begin{document}

\begin{center}
{\Large\bf University of Waterloo}\\
\vspace{3mm}
{\Large\bf CS240E, Winter 2021}\\
\vspace{3mm}
{\Large\bf Final Answer Templates}\\
\vspace{3mm}
\end{center}

For all answers where no section is given here, there is no template.

Recall that the LEARN page (under Content $\rightarrow$ Textbook) has the
\LaTeX-sources for many figures of the textbook; you may find this useful
for drawing some of the answers.

\newpage
\addtocounter{section}{3}
\iffalse
\section{Hashing}

\begin{center}
\begin{tabular}{r||c|c|c|c|c}
$k$ & 0 & 1 & 2 & 3 & 4 \\
\hline
$f_{a,b}(k)$ & & & & & \\[1.2ex]
\hline
$h_{a,b}(k)$ & & & & & \\[1.2ex]
\end{tabular}
\end{center}

\newpage
\fi
\section{Quad trees}
\begin{tikzpicture}[scale=0.6]
	\draw [dotted] (8,0)--(-1,0) node[left] {$0$};
	\draw [dotted] (8,1)--(-1,1) node[left] {$1$};
	\draw [dotted] (8,2)--(-1,2) node[left] {$2$};
	\draw [dotted] (8,3)--(-1,3) node[left] {$3$};
	\draw [dotted] (8,4)--(-1,4) node[left] {$4$};
	\draw [dotted] (8,5)--(-1,5) node[left] {$5$};
	\draw [dotted] (8,6)--(-1,6) node[left] {$6$};
	\draw [dotted] (8,7)--(-1,7) node[left] {$7$};
	\draw [dotted] (0,-1)--(0,8) node[above] {$0$};
	\draw [dotted] (1,-1)--(1,8) node[above] {$1$};
	\draw [dotted] (2,-1)--(2,8) node[above] {$2$};
	\draw [dotted] (3,-1)--(3,8) node[above] {$3$};
	\draw [dotted] (4,-1)--(4,8) node[above] {$4$};
	\draw [dotted] (5,-1)--(5,8) node[above] {$5$};
	\draw [dotted] (6,-1)--(6,8) node[above] {$6$};
	\draw [dotted] (7,-1)--(7,8) node[above] {$7$};
  \end{tikzpicture}

\newpage
\section{Pattern Matching}

\begin{tabular}{c||c|c|c|c|c|c|c|c|c||c}
& \multicolumn{9}{c||}{$T$} \\ \cline{2-10}
$i$ & C & A & T & G & C & A & C & T & C & $h_i$ \\
\hline
\hline
0 & \cellcolor{lightgray} & \cellcolor{lightgray} & \cellcolor{lightgray} & \cellcolor{lightgray} & \cellcolor{lightgray} &&&&\\
\hline
1 & & \cellcolor{lightgray} & \cellcolor{lightgray} & \cellcolor{lightgray} & \cellcolor{lightgray} & \cellcolor{lightgray} &&&\\
\hline
2 && & \cellcolor{lightgray} & \cellcolor{lightgray} & \cellcolor{lightgray} & \cellcolor{lightgray} & \cellcolor{lightgray} &&\\
\hline
3 & && & \cellcolor{lightgray} & \cellcolor{lightgray} & \cellcolor{lightgray} & \cellcolor{lightgray} & \cellcolor{lightgray} &\\
\hline
4 &&&& & \cellcolor{lightgray} & \cellcolor{lightgray} & \cellcolor{lightgray} & \cellcolor{lightgray} & \cellcolor{lightgray} \\
\hline
\end{tabular}
\end{document}
