A C++ benchmark comparing insertion sort, merge sort, and quicksort across increasingly large randomized inputs. The program counts comparisons and swaps, exports results, and supports Gnuplot visualizations on linear and logarithmic scales.
At 10,000 elements, insertion sort required roughly 49.8 million measured operations, compared with approximately 254 thousand for merge sort and 253 thousand for quicksort. The experiment makes the practical difference between quadratic and n log n growth visible.
The measured growth illustrates insertion sort's quadratic behavior and the substantially better scaling of merge sort and quicksort.
g++ -std=c++17 -O2 main.cpp -o sorting-benchmark
./sorting-benchmarkWith Gnuplot installed, run generate_all_plots.sh to regenerate the charts.
The benchmark was verified by compiling with a C++17 compiler and checking that each algorithm produces sorted output for the generated input sizes. The committed sorting_results.csv records the comparison, swap, and total-operation counters used in the charts.
g++ -std=c++17 -O2 -Wall -Wextra main.cpp -o sorting-benchmark
./sorting-benchmarkThis is an independent algorithm-analysis portfolio project; no formal course attribution is claimed in the source materials.
The benchmark was verified by compiling with a C++17 compiler and checking that each algorithm produces sorted output for the generated input sizes. The committed sorting_results.csv records the comparison, swap, and total-operation counters used in the charts.
g++ -std=c++17 -O2 -Wall -Wextra main.cpp -o sorting-benchmark
./sorting-benchmarkThis is an independent algorithm-analysis portfolio project; no formal course attribution is claimed in the source materials.
- C++ algorithm implementation
- Experimental algorithm analysis
- Comparisons and swap instrumentation
- CSV export and Gnuplot visualization
- Relating measured behavior to Big-O complexity
Built by Ahmed Balde to connect algorithm theory with measured runtime behavior. See more C++, Python, data, and software-engineering work on GitHub.


