in reply to My best attempt at sorting. Kindly suggest improvements/modifications.
As long as you only want to sort a reasonable number of small positive integers, try sleep sort. It features a very nice behaviour regarding CPU load, but unfortunately, it is a little bit slow. Nevertheless, it does sort small positive integers quite well.
Some implementations also allow sorting positive floating point numbers.
By adding a sufficiently large number to the numbers to be sorted, the algorithm can easily be extended to sort both positive and negative numbers.
Alexander
|
|---|