From 0baf9af6e2e150a17b96366441310b8080929277 Mon Sep 17 00:00:00 2001 From: Navid Samanghoon Date: Thu, 23 Oct 2025 18:50:43 +0200 Subject: More about design --- report/report.tex | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/report/report.tex b/report/report.tex index bcd107a..82e78af 100644 --- a/report/report.tex +++ b/report/report.tex @@ -76,6 +76,17 @@ Lastly an important design choice has been creating an array of pointers to each 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. +\textbf{Sorting:} +After parsing, a sorting algorithm of choice can be used on the coordinates. The currently implemented sorting algorithms are +quick-sort and insertion-sort. Both algorithms have been designed to allow sorting both on the x-coordinate and the y-coordinate. This +is easily achievable because of the array of pointers. The chosen algorithm can be passed as a command line argument, otherwise +a default algorithm will be run. This design where an algorithm can be passed to the sorting function, allows the programmed to be +extended with new algorithms if needed. + +\textbf{Generating output:} An important and necessary side effect of the \textit{make\_array\_from\_file} is converting ASCII characters +to 8-byte integers. This allows the sorting algorithm to make numeric comparisons on the data. But this also means that the data should +be converted back to ASCII, before any output can be printed. + \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 -- cgit v1.2.3-70-g09d2