sort.cpp: http://pastebin.com/f1b85d015
This program contains functions to sort an array of integers in descending order in 11 different ways :-
- Simple sort (Compare every element to every other element)
- Quicksort
- Dual pivot quicksort (The fastest general purpose sort)
- Insertion sort
- Selection sort
- Bubble sort
- Merge sort
- Heap sort
- Count sort (sorts in O(n) time)
- Bucket sort (works on data distributed uniformly across a range)
- Radix sort
The Dual Pivot Quicksort I wrote isn't as efficient as the one written by Vladimir Yaroslavskiy for the java.util.Arrays class, but the performance is better than the other sorting algorithms for large array sizes.
You can modify the code to sort in increasing order by interchanging > and <.