From b5aec49b21f0efb1db258af5b33babfe9da7cd36 Mon Sep 17 00:00:00 2001
From: Camil Staps
Date: Mon, 12 Oct 2015 23:28:15 +0200
Subject: Start assignment 7

---
 assignment7.tex | 145 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 145 insertions(+)
 create mode 100644 assignment7.tex

(limited to 'assignment7.tex')

diff --git a/assignment7.tex b/assignment7.tex
new file mode 100644
index 0000000..b988aa6
--- /dev/null
+++ b/assignment7.tex
@@ -0,0 +1,145 @@
+\documentclass[10pt,a4paper]{article}
+
+\usepackage[margin=2cm]{geometry}
+\usepackage{multicol}
+
+\let\assignment7
+
+\usepackage{enumitem}
+\setenumerate[1]{label=\assignment.\arabic*.}
+\setenumerate[2]{label=\textit{\alph*})}
+
+% textcomp package is not available everywhere, and we only need the Copyright symbol
+% taken from http://tex.stackexchange.com/a/1677/23992
+\DeclareTextCommandDefault{\textregistered}{\textcircled{\check@mathfonts\fontsize\sf@size\z@\math@fontsfalse\selectfont R}}
+
+\usepackage{fancyhdr}
+\renewcommand{\headrulewidth}{0pt}
+\renewcommand{\footrulewidth}{0pt}
+\fancyhead{}
+\fancyfoot[C]{Copyright {\textcopyright} 2015 Camil Staps}
+\pagestyle{fancy}
+
+\usepackage{amsmath}
+\usepackage{amsthm}
+\usepackage{amsfonts}
+\DeclareMathAlphabet{\pazocal}{OMS}{zplm}{m}{n}
+
+\usepackage{tikz}
+\usepackage{array}
+\usepackage{caption}
+\usepackage[hidelinks]{hyperref}
+\usepackage{url}
+
+\parindent0pt
+
+\title{Algoritmen en Datastructuren - assignment \assignment}
+\author{Camil Staps\\\small{s4498062}}
+
+\begin{document}
+
+\maketitle
+\thispagestyle{fancy}
+
+\begin{multicols}{2}
+
+\begin{enumerate}
+    \item The initial tree would be:
+        
+        \begin{minipage}{\linewidth}
+            \centering
+            \vskip10pt
+            \begin{tikzpicture}[every node/.style={draw,circle,minimum width=2em},
+                                level 1/.style={sibling distance=9em},
+                                level 2/.style={sibling distance=5em},
+                                level 3/.style={sibling distance=3em},
+                                font={\footnotesize}]
+                \node {9}
+                    child { node {5}
+                        child { node {4} }
+                        child { node {7}
+                            child[missing] { node {} }
+                            child { node {8} }
+                        }
+                    }
+                    child { node {12}
+                        child { node {10}
+                            child[missing] { node {} }
+                            child { node {11} }
+                        }
+                        child { node {18} }
+                    };
+            \end{tikzpicture}
+        \end{minipage}\\
+
+        After removing $9$:
+
+        \begin{minipage}{\linewidth}
+            \centering
+            \vskip10pt
+            \begin{tikzpicture}[every node/.style={draw,circle,minimum width=2em},
+                                level 1/.style={sibling distance=9em},
+                                level 2/.style={sibling distance=5em},
+                                level 3/.style={sibling distance=3em},
+                                font={\footnotesize}]
+                \node {10}
+                    child { node {5}
+                        child { node {4} }
+                        child { node {7}
+                            child[missing] { node {} }
+                            child { node {8} }
+                        }
+                    }
+                    child { node {12}
+                        child { node {11} }
+                        child { node {18} }
+                    };
+            \end{tikzpicture}
+        \end{minipage}\\
+
+        After removing $5$:
+
+        \begin{minipage}{\linewidth}
+            \centering
+            \vskip10pt
+            \begin{tikzpicture}[every node/.style={draw,circle,minimum width=2em},
+                                level 1/.style={sibling distance=9em},
+                                level 2/.style={sibling distance=5em},
+                                font={\footnotesize}]
+                \node {10}
+                    child { node {7}
+                        child { node {4} }
+                        child { node {8} }
+                    }
+                    child { node {12}
+                        child { node {11} }
+                        child { node {18} }
+                    };
+            \end{tikzpicture}
+        \end{minipage}
+
+    \item \begin{enumerate}
+            \item %todo
+            \item For a node $v$:
+
+                \begin{itemize}
+                    \item If $v$ is nil, return $0$.
+                    \item If $v$ is a leaf node, return $1$.
+                    \item If $v$ has children, return the sum of the number of leaves of the children.
+                \end{itemize}
+
+                Note that this works on any tree.
+        \end{enumerate}
+
+    \item %todo
+
+    \item %todo
+
+    \item %todo
+
+\end{enumerate}
+
+\end{multicols}
+
+\end{document}
+
-- 
cgit v1.2.3

