https://github.com/rswinkle/sorting
A collection of sorting algorithms and a simple benchmark program
https://github.com/rswinkle/sorting
heapsort mergesort quicksort sorting sorting-algorithms
Last synced: 10 months ago
JSON representation
A collection of sorting algorithms and a simple benchmark program
- Host: GitHub
- URL: https://github.com/rswinkle/sorting
- Owner: rswinkle
- License: mit
- Created: 2012-11-25T05:23:44.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2020-07-13T21:17:18.000Z (almost 6 years ago)
- Last Synced: 2025-03-18T22:19:32.322Z (about 1 year ago)
- Topics: heapsort, mergesort, quicksort, sorting, sorting-algorithms
- Language: C
- Homepage:
- Size: 84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
Sorting Algorithms
==================
[](https://repl.it/github/rswinkle/sorting)
This is just a set of sorting algorithms and a benchmarking program.
I should add several more sorting algorithms and have a cleaner divided system for testing
sets of algorithms with different Big-O running times.
I realize that clock() isn't the most accurate/precise timing method
but it's simple to use and will result in the same ranking even if
those numbers aren't actually milliseconds.
"The clock() function returns the processor time since the program started, or - 1 if
that information is unavailable. To convert the return value to seconds, divide it
by CLOCKS_PER_SEC. (Note: if your compiler is POSIX compliant, then CLOCKS_PER_SEC is
always defined as 1000000.) "
Building and Running
====================
You can use the included makefile:
cd build
make
./benchmark
Or you can regenerate it or another build system using premake5
premake5 gmake
cd build
make
./benchmark
There's benchmark is the main C program that I usually update and test with new algorithms
and cppbenchmark which I only occasionally use, mostly just to make sure everything still compiles
and runs the same as C++.
The results are pretty self explanatory but you can redirect them to a file (output.dat) and then
run plotbarchart.py to get a "nice" bar chart of the data. See heapsort_times.png and quicksort_times.png
for old examples.
Algorithms
==========
- [x] Quicksort and 3 variations
- [x] Heap sort and 2 variations
- [x] Merge sort and 1 variation
- [x] Insertion sort
- [ ] Radix sort
- [ ] Shell sort
- [ ] Comb sort
- [ ] Gnome Sort, Bubble Sort, etc.