diff options
| author | Navid Samanghoon <nsama24@student.sdu.dk> | 2025-10-23 18:50:43 +0200 |
|---|---|---|
| committer | mithe24 <mithe24@student.sdu.dk> | 2025-10-29 13:49:57 +0100 |
| commit | 0baf9af6e2e150a17b96366441310b8080929277 (patch) | |
| tree | c882af75c6d26203f7b2949a5c04383574e7a1e4 /report | |
| parent | f7120b704a721d6bd8158182bf319274a0182544 (diff) | |
| download | sorter-0baf9af6e2e150a17b96366441310b8080929277.tar.gz sorter-0baf9af6e2e150a17b96366441310b8080929277.zip | |
More about design
Diffstat (limited to '')
| -rw-r--r-- | report/report.tex | 11 |
1 files changed, 11 insertions, 0 deletions
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 |