diff options
| author | mithe24 <mithe24@student.sdu.dk> | 2025-10-30 08:50:30 +0100 |
|---|---|---|
| committer | mithe24 <mithe24@student.sdu.dk> | 2025-10-30 08:50:30 +0100 |
| commit | c7046a8f4762730fd538f82fa9e90d67e5cde25d (patch) | |
| tree | 4d0cc06a70ede6d2ba16fbc4bde53af0f7ae624e /report/report.tex | |
| parent | 218bea91e83d44878e5aeca1c692de93d233a66f (diff) | |
| download | sorter-c7046a8f4762730fd538f82fa9e90d67e5cde25d.tar.gz sorter-c7046a8f4762730fd538f82fa9e90d67e5cde25d.zip | |
report(typos): and such
Diffstat (limited to 'report/report.tex')
| -rw-r--r-- | report/report.tex | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/report/report.tex b/report/report.tex index 133c2d6..b88d247 100644 --- a/report/report.tex +++ b/report/report.tex @@ -29,7 +29,7 @@ xleftmargin=1.5em, breaklines]{c}{#3}} \begin{center} \pagenumbering{gobble} \Huge - Sorting in x86\_64 Linux Assembly + Sorting in X86-64 Linux Assembly \vspace{1cm} \Large @@ -55,13 +55,13 @@ xleftmargin=1.5em, breaklines]{c}{#3}} Sorting is one of the most fundamental operations in programming. Sorting algorithms play a crucial role in efficient searching, organization, interpretation of data, and optimization problems. Furthermore, sorting is often -times the first step towards designing complicated algorithms in computer +the first step towards designing complicated algorithms in computer science. \smallskip \noindent This project aims to study efficient sorting of a list of coordinates, -when sorting by the second coordinate. This will be done solely in +when sorting by the second coordinate. This will be done entirely in \textit{x86\_64 Linux Assembly}. Although abstract high level languages such as \textit{Python} and \textit{Java} allow faster and convenient development, Assembly provides precise control over program flow, memory usage and @@ -94,8 +94,7 @@ solving errors. \smallskip \noindent -Below is a flowchart visualizing each step, followed by a short -summary of the design. +The flowchart below visualize each step. \begin{figure}[H] \centering @@ -147,9 +146,6 @@ numbers would for example require extra logic for parsing, comparison, converting back and forth to ASCII, and allocating memory. \smallskip -\noindent -Both input and output follow this strict format. - \subsection{Selecting algorithms} The ability to choose which algorithm to use can be quite beneficial, if you know certain aspects about your data. Therefore a design choice has been allowing @@ -162,20 +158,20 @@ This design decision is great for flexibility, and also supports future exceptio of the program. \subsection{Why Insertionsort and Quicksort?} -Insertion sort and quick sort have been handpicked to research the trade-offs +Insertionsort and Quicksort have been handpicked to research the trade-offs between algorithmic simplicity and computational efficiency. Furthermore, these algorithms are widely different in nature. \smallskip \noindent -Insertion sort is an iterative algorithm, depending primarily on memory usage, +Insertionsort is an iterative algorithm, depending primarily on memory usage, registers, and program flow, \smallskip \noindent -while quick sort is a recursive algorithm using the divide and conquer approach. +while Quicksort is a recursive algorithm using the divide and conquer approach. This is interesting, because Quicksort is expected to excel on large random -datasets, while insertion sort is more suitable for small or nearly sorted +datasets, while Insertionsort is more suitable for small or nearly sorted cases, which is another great motivation to understand what is really happening when these algorithms are executed, and how the dataset affects them. @@ -316,7 +312,7 @@ of the array toward the middle. The left pointer advances rightward while pointing at elements smaller than the \textit{pivot}, and the right pointer advances leftward while pointing at elements larger than the \textit{pivot}. -When both pointers both pointers points at misplaced elements, they swap them. +When both pointers points at misplaced elements, they swap them. \smallskip \noindent @@ -367,7 +363,7 @@ This works because each digit is in order in the \textit{ASCII Table}. \smallskip \noindent -But the algorithm have the downside of getting each digit +But the algorithm has the downside of getting each digit in \textit{reverse} order, means we need to start right side of the \textit{buffer} when adding new digits, as to not \textit{overwrite} previous digits. \smallskip @@ -417,11 +413,11 @@ and when it's \textit{set} both pointers \textit{decrement}. This \textit{instruction} is particularly useful for bulk memory operations such as copying strings as it encodes a potentially lengthy loop into a \textit{single} instruction, -thereby improving both code density +thereby improving code density. \section{Evaluation} -To evaluate whether out program works, we created three \textit{shell scripts}, +To evaluate whether our program works, we created three \textit{shell scripts}, one for generating test data (\textit{generate\_test\_data.sh}), one for testing the validity of the output of the program (\textit{test.sh}) and one for testing the execution time of the program (\textit{benchmark.sh}). @@ -447,7 +443,7 @@ the output with the output from the \textit{GNU Core Utilities} program \textit{ \smallskip \noindent -Given all of the tests pass, we can then run \textit{benchmark.sh}, which times +If all of the tests pass, we can then run \textit{benchmark.sh}, which times how long it takes for our program to run with each test file for each algorithm, and saves the result in a \textit{csv} file. The results of this \textit{csv} file, together with functions asymptotically equivalent to $\mathcal O(n)$, $\mathcal O(n\log @@ -601,7 +597,7 @@ affect and boost performance. \section{Conclusion} In this project insertionsort and quicksort have been implemented in assembly x86 64 with the goal of studying efficient sorting. Although the algorithms perform the same task, -they are in fact very different. +they are quite very different. \smallskip \noindent @@ -612,16 +608,16 @@ having the same size. \smallskip \noindent -As discussed, earlier insertionsort and quicksort have roughly +As discussed earlier, insertionsort and quicksort have roughly the same performance on reversed datasets, insertionsort is optimal on sorted or -small datasets, and quicksort excels on random and very large datasets. So one -could say that efficient sorting requires an efficient algorithm well suited for +small datasets, and quicksort excels on random and very large datasets. Thus +efficient sorting requires an efficient algorithm well-suited for the dataset. But it should also be mentioned that in most general cases with random output quicksort will most likely outperform insertionsort. \smallskip \noindent -Furthermore, from the testings we have learned that the stable tests used on insertion sort +Furthermore, from the testings we have learned that the stable tests used on Insertionsort cannot be used on quicksort, since quicksort doesn’t preserve the order the inputs. This means that the algorithms might produce different results even if used on the same dataset. |