diff options
| author | Andreas Kapp Lindquist <andkaplin05@gmail.com> | 2025-10-29 17:07:53 +0100 |
|---|---|---|
| committer | Andreas Kapp Lindquist <andkaplin05@gmail.com> | 2025-10-29 18:33:28 +0100 |
| commit | 6ee05e0790fe0f830ca5b065ab190d8c39e70482 (patch) | |
| tree | 7ba118bb4e12f039aed6de24bc871e5c7728b852 /report/report.tex | |
| parent | 4d4140fbd75434e3faa88bbf382f55c02a922435 (diff) | |
| download | sorter-6ee05e0790fe0f830ca5b065ab190d8c39e70482.tar.gz sorter-6ee05e0790fe0f830ca5b065ab190d8c39e70482.zip | |
report(array_maker): More
Diffstat (limited to 'report/report.tex')
| -rw-r--r-- | report/report.tex | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/report/report.tex b/report/report.tex index 8989253..ea688ac 100644 --- a/report/report.tex +++ b/report/report.tex @@ -195,11 +195,35 @@ We implemented a global function \texttt{array\_maker}, that takes the array, and the number of elements. With this it then first calls a function \texttt{create\_file\_buffer}, that reads the contents of the file and puts it in memory. It then passes this address, and the length of the file onto the -function \texttt{make\_pairwise\_data} +function \texttt{make\_pairwise\_data}. This function removes +\texttt{\textbackslash t} and \texttt{\textbackslash n}, and puts the integers +side-by-side, with space for 64-bit integers. This format is nice, because it +allows us to iterate over the number of coordinates, and select every $2n$ pair +as the place in memory where the $n^\text{th}$ pair in the array points to. + + +\begin{algorithm}[H] + \DontPrintSemicolon % optional: removes ; + \SetKwInOut{Input}{Input} + \SetKwInOut{Output}{Output} + + \Input{File descriptor $f$} + \Output{Pointer and size of array $A$} + \BlankLine + + \texttt{// Pointer to file data in $p$ and length of that data in $n$.}\\ + $p,n\leftarrow$ create\_file\_buffer($f$)\\ + \texttt{// Pointer to pairwise data in $p$ and number of pairs in $n$}\\ + $p,n\leftarrow$ make\_pairwise\_data($p,n$)\\ + \texttt{// Allocate space for final array, and save pointer in $A$}\\ + $A\leftarrow$ allocate($8n$)\\ + \Return $p$ and $n$ + + \caption{Quicksort} +\end{algorithm} \begin{figure}[H] - \snippet{19}{46}{../src/array_maker.s} - \caption{Code snippet from \texttt{array\_maker.s}}\label{fig:arraysnippet} + \caption{Psudocode of \texttt{array\_maker.s}}\label{fig:arraysnippet} \end{figure} Load file in memory |