I am trying to come up with an efficient sorting algorithm to sort a set of values from 0 to 30,000. There are no duplicate numbers in the set, and I want to use as little memory requirements as possible.
This is just a logical problem and I can write it in psudocode or C, C++ doesn't matter. I just wanted to get your opinions on which algorithm you feel would probably be the best for these circumstances.
In my opinion I am thinking quick sort. What do others think?
unction quicksort(array)
var list less, greater
if length(array) ≤ 1
return array
select and remove a pivot value pivot from array
for each x in array
if x ≤ pivot then append x to less
else append x to greater
return concatenate(quicksort(less), pivot, quicksort(greater))