\documentclass{article}
\usepackage{graphicx}
\graphicspath{ {./images/} }
\usepackage[utf8]{inputenc}
\usepackage{float}
\usepackage{indentfirst}
\setlength{\parskip}{\baselineskip}%

\title{CS 7353: Analysis of Algorithms Project: Red-Black Tree}
\author{Noah Schrick}
\date{April 21, 2022}

\begin{document}

\maketitle
\tableofcontents

\section{Problem Introduction}

\section{Program Platform and Submission Files}
This problem was solved using C++ on a Linux system.
Attached with the submission is a zip folder that contains:
\begin{itemize}
    \item{A CMakeLists.txt file for compiling}
    \item{An "images" folder that contains:}
    \begin{enumerate}
        \item{Various images included in this report}
    \end{enumerate}
    \item{A "src" folder that contains:}
    \begin{enumerate}
        \item{A Node.cpp and Node.h file for the Node class and associated functions}
        \item{A Red-Black.cpp and Red-Black.h file for the Red-Black Tree class and
            associated functions}
        \item{The main file}
    \end{enumerate}
    \item{A "build" folder that contains:}
    \begin{enumerate}
        \item{A build.sh script to simplify the build process}
        \item{A run.sh script to simplify running the program}
        \item{Various CMake files}
        \item{The compiled binaries for the program and associated libraries}
    \end{enumerate}
    \item{Various LaTeX files used in the generation of this report.}
\end{itemize}

This program offers no guarantee of functionality on other Operating Systems. Testing was only conducted on the local Linux machine.

\section{Programming Approach}
\subsection{Node Class}
This work approached the problem with a traditional method when working with tree structures by using a series of connected nodes. To achieve this, a ``Node" class was implemented. The Node class contains 5 private members: a pointer to the parent node, a pointer to the left child, a pointer to the right child, an integer key, and an integer color. Public class functions include auxiliary functions to get and set the pointers for the parent and children nodes, get and set the color value, and get the key. The Node class is constructed with an integer key value, the color is initialized to red, and the parent and children node pointers are initialized to null pointers using C++'s ``nullptr" keyword.

To minimize programmer error and to alleviate effort, an enum titled ``colors" was created, with black being set to 0, and red set to 1. Likewise, a color name character array was created, with ``black" in the first position, and red in the second. When getting and setting colors, rather than needing to remember (or look for) the value of red or black, the programmer can simply pass ``red" or ``black", which will then be converted to its proper integer value. Since Red-Black trees use bits to represent the color, this approach was preferred over the utilization of a string member for color.

For debugging purposes, a print function was also created. This function will print the key, color, parent key, left child key, and right child key of a given node.

\subsection{Red-Black Tree Class}

\subsubsection{Insert}

\subsubsection{Delete}

\subsubsection{Tree Cleanup} \label{sec:print}

\subsubsection{Display}

\section{Results}
\subsection{Part 1.B: ``Tree 1"}
\begin{figure}[htp]
    \centering
    \includegraphics[width=\linewidth]{"./images/b_init_tree.png"}
    \vspace{.2truein} \centerline{}
        \caption{Part 1.B: Initial Tree After Key Insertions}
        \label{fig:b_init}
\end{figure}

\begin{figure}[htp]
    \centering
    \includegraphics{"./images/b_del_12.png"}
    \vspace{.2truein} \centerline{}
        \caption{Part 1.B: Tree After Deleting Key 12}
        \label{fig:b_12}
\end{figure}

\begin{figure}[htp]
    \centering
    \includegraphics{"./images/b_ins_32.png"}
    \vspace{.2truein} \centerline{}
        \caption{Part 1.B: Tree After Inserting Key 32}
        \label{fig:b_32}
\end{figure}

\begin{figure}[htp]
    \centering
    \includegraphics{"./images/b_del_41.png"}
    \vspace{.2truein} \centerline{}
        \caption{Part 1.B: Tree After Deleting Key 41}
        \label{fig:b_41}
\end{figure}

\subsection{Part 1.C: ``Tree 2"}
\begin{figure}[htp]
    \includegraphics[width=\linewidth]{"./images/c_init_tree.png"}
    \vspace{.2truein} \centerline{}
        \caption{Part 1.C: Initial Tree After Key Insertions}
        \label{fig:b_init}
\end{figure}

\begin{figure}[htp]
    \includegraphics[width=\linewidth]{"./images/c_del_127.png"}
    \vspace{.2truein} \centerline{}
        \caption{Part 1.C: Tree After Deleting Key 127}
        \label{fig:c_127}
\end{figure}

\begin{figure}[htp]
    \includegraphics[width=\linewidth]{"./images/c_del_221.png"}
    \vspace{.2truein} \centerline{}
        \caption{Part 1.C: Tree After Deleting Key 221}
        \label{fig:c_221}
\end{figure}

\section{Part 2: Red-Black Discussion}

\end{document}