From 11f9175014e6a40263c8b3d417bbcc287ee1fa1b Mon Sep 17 00:00:00 2001 From: Andreas Kapp Lindquist Date: Tue, 28 Oct 2025 11:34:50 +0100 Subject: report(implementation): Quicksort and Insertionsort plot --- report/report.tex | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'report') diff --git a/report/report.tex b/report/report.tex index bf293b5..5b252ba 100644 --- a/report/report.tex +++ b/report/report.tex @@ -9,6 +9,9 @@ \usepackage{siunitx} \usepackage{algorithm2e} \usepackage{float} +\usepackage{caption} +\usepackage{subcaption} + \geometry{a4paper} \begin{document} @@ -246,19 +249,24 @@ output from the \textit{builtin} function \textit{sort}. Given all of the tests pass, we can then run \textit{benchmark.sh}, which times how long it takes for out program to run with each test file, and saves the result in a \textit{csv} file. + \begin{figure}[H] \centering \begin{tikzpicture} + \begin{axis}[ xlabel={size}, ylabel={seconds}, - % xmode=log, - % ymode=log, + ymode=log, + width=\textwidth, legend pos=north west, scatter/classes={ - random={mark=*,red}, - reverse={mark=*,green}, - sorted={mark=*,blue} + isort_random={mark=*,red}, + isort_reverse={mark=*,green}, + isort_sorted={mark=*,blue}, + qsort_random={mark=*,cyan}, + qsort_reverse={mark=*,magenta}, + qsort_sorted={mark=*,yellow} } ] @@ -268,20 +276,20 @@ result in a \textit{csv} file. ] table [x=size, y=real, meta=type, col sep=comma] {../test/benchmark_results.csv}; - \legend{random, reverse, sorted} + \legend{isort\_random, isort\_reverse, isort\_sorted, qsort\_random, qsort\_reverse, qsort\_sorted} - \addplot[domain=100:100000, samples=10, thick, densely dotted, black]{x/250000}; - \addlegendentry{$\mathcal O(\text{size})$} + % \addplot[domain=100:100000, samples=10, thick, densely dotted, black]{x/250000}; + % \addlegendentry{$\mathcal O(\text{size})$} + % + % \addplot[domain=100:100000, samples=10, thick, dashed, black]{(x*x)/4000000000}; + % \addlegendentry{$\mathcal O(\text{size}^2)$} - \addplot[domain=100:100000, samples=10, thick, dashed, black]{(x*x)/4000000000}; - - \addlegendentry{$\mathcal O(\text{size}^2)$} \end{axis} \end{tikzpicture} - \caption{Benchmarking of Insertion-sort with random data, reversely sorted - data, and sorted data.} + \caption{}\label{fig:} \end{figure} + \section{Conclusion} \end{document} -- cgit v1.2.3-70-g09d2