\documentclass[12pt]{article}

\usepackage{amsmath,amsfonts}
\usepackage{graphicx}
\usepackage{enumerate}
\usepackage{tikz}

\usepackage{fullpage,url,amssymb,epsfig,color,xspace}
\usepackage[pdftitle={CS240 Tutorial 0},%
pdfsubject={University of Waterloo, CS240, Spring 2023},%
pdfauthor={}]{hyperref}

\renewcommand{\thesubsection}{Problem \arabic{subsection}}

% UP there is the preamble

%\commandname[opt, args]{reqd, args}

%\begin{envirname}
%	stuff
%\end{envirname}

\begin{document}

\begin{center}
{\Large\bf University of Waterloo}\\
\vspace{3mm}
{\Large\bf CS240 Spring 2023}\\
\vspace{2mm}
{\Large\bf Tutorial 00}
\end{center}

\definecolor{care}{rgb}{0,0,0}
\def\question#1{\item[\bf #1.]}
\def\part#1{\item[\bf #1)]}
\newcommand{\pc}[1]{\mbox{\textbf{#1}}}

% _ underscore below
% ^ caret above

\section{Mathematics}

Write a proof showing that $\log(n!) \in O(n \log n)$. \\

\begin{align*}
    \log(n!) &= \log(n \times (n-1) \times \cdots \times 2 \times 1) & (\text{for } n \ge 1)\\
      &= \log\left(\prod_{i=1}^{n} i\right)\\
      &= \sum_{i=1}^{n} \log i \\
      &= \log(n) + \log(n-1) + \cdots + \log(2) + \log(1)\\
      & \le \log(n) + \log(n) + \cdots + \log(n) + \log(n) \\
      &= n\log(n)\\
\end{align*}

Therefore, for $c = 1$ and $n_0 = 1$, $$0 \le \log(n!) \le cn\log(n)$$ for all $n \ge n_0$.

%\node{label};
%\node{label}
%   child {}
%;

\section{Trees}
We will add the letters Z, A, and B to the BST below. \\
\begin{center}\begin{tikzpicture}[
  level distance=45 pt,
  every node/.style={circle,draw},
  level 1/.style={sibling distance=200 pt},
  level 2/.style={sibling distance=100 pt},
  level 3/.style={sibling distance=60 pt},
  level 4/.style={sibling distance=30 pt}
]
  \node {M$_{0}$}
    child {node {F$_{0}$}
      child {node {C$_{0}$}
        child {node {A$_{0}$}
            child[missing]
            child {node {B$_{0}$}}}
        child[missing]}
      child {node {I$_{0}$}}
    }
    child {node {T$_{0}$}
      child {node {Q$_{0}$}}
      child {node {W$_{0}$}
        child[missing]
        child {node {Z$_{0}$}}}
    };
\end{tikzpicture}\end{center}

{\it Hint: For nodes with only one child, you may wish to use ``child[missing]'' for the non-existent child.}


\section{Plots}

Plot the following points below. Only show the resulting plot.\\
Points: (2,7), (1,3), (3,1), (7,7)

\begin{center}
\begin{tikzpicture}
		\draw[thick,]  (0,9) -- (0,0) node[left] {0};
		\draw[thick,]  (0,0) -- (9,0) node[below] {9};
		\draw[thick,]  (9,9) -- (9,0) node[left] {};
		\draw[thick,]  (9,9) -- (0,9) node[left] {9};
		
		\fill (2, 7) circle[radius=2.5pt] node[right]{(2,7)};
		\fill (1, 3) circle[radius=2.5pt] node[right]{(1,3)};
		\fill (3, 1) circle[radius=2.5pt] node[below left]{(3,1)};
		\fill (7, 7) circle[radius=2.5pt] node[above]{(7,7)};
\end{tikzpicture}
\end{center}

\section{Latex Resources}
 \LaTeX\ Editors

 \begin{enumerate}[a)]
 \item{TeX Live: \url{https://www.tug.org/texlive/}}
 \item{TeXstudio: \url{https://www.texstudio.org/}}
 \item{Overleaf: \url{https://www.overleaf.com/}}
 \item{pdflatex: on the student environment}
 \end{enumerate} 
 \bigskip
 
 Miscellaneous Resources
 \begin{itemize}
 \item{\url{http://detexify.kirelabs.org/classify.html}}
 \item{\url{https://oeis.org/wiki/List_of_LaTeX_mathematical_symbols}}
 \item{\url{https://en.wikibooks.org/wiki/LaTeX}}
 \item{\url{https://tex.stackexchange.com/}}
 \end{itemize}

\end{document}
