From f7120b704a721d6bd8158182bf319274a0182544 Mon Sep 17 00:00:00 2001
From: Navid Samanghoon <nsama24@student.sdu.dk>
Date: Thu, 23 Oct 2025 17:41:24 +0200
Subject: Wrote about design

---
 report/report.tex | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

(limited to 'report/report.tex')

diff --git a/report/report.tex b/report/report.tex
index 5b0d40e..bcd107a 100644
--- a/report/report.tex
+++ b/report/report.tex
@@ -52,10 +52,11 @@ actual runtime to their theoretical runtimes. These datasets will be ranging fro
 cases with duplicates or nearly sorted lists.
 
 \section{Design}
-\begin{itemize}
-    \item 3 stage process, read $\rightarrow$ sort $\rightarrow$ print
-    \item Array format
-\end{itemize}
+The program is structured into four main phases: reading input, parsing data, sorting, and generating output. Each phase is
+designed to handle a specific task, which creates modulariy and clarity. Whitin each phase a set of functions manage the corresponding
+operations, allowing the programmer to focus on one task at a time. This design also greatly supports debugging
+by simplifying tracking and solving errors. Below is a flowchart visualizing each step, followed by
+a short summary of the program.
 
 \begin{figure}[H]
     \centering
@@ -64,7 +65,18 @@ cases with duplicates or nearly sorted lists.
     \label{fig:flowchart}
 \end{figure}
 
-\subsection{The Array}
+\textbf{Reading Input:} The input file is given as a command line argument. Each coordinate consists of two values, the first
+coordinate x followed by a tab character, and the second coordinate y followed by a newline character. The first step of the program
+is to find this file, calculate the size of it using a function called \textit{getFileSize}, allocating memory, and saving the
+data.
+
+\textbf{Parsing the data:} Next, the received file is to be parsed, meaning that only useful data will be extracted. This process omits
+the tabs, and newlines, which in turn significantly simplifies iteration through the data, by ensuring that only 8-byte coordinates are left.
+Lastly an important design choice has been creating an array of pointers to each coordinatepair.
+This design is explained in further detail later. All of this logic has been wrapped in a function \textit{make\_array\_from\_file}, which
+utilizes several smaller helper functions to perform this parsing process.
+
+\subsection{Why an array of pointers?}
 In order to be a litte more general, and make our program easily expandable to
 different types of data, we wanted to create out own array datatype, that
 allowes us to sort something more abstract, with respect to a key in that
-- 
cgit v1.2.3-70-g09d2

