Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



Re: My sorting algorithm that counts in values in arrays, JTsort or Countsort
Posted:
Jan 4, 2013 9:40 AM


JT <jonas.thornvall@gmail.com> writes:
> On 4 Jan, 04:05, JT <jonas.thornv...@gmail.com> wrote: >> I once created this algorithm that works a bit backward it actually >> first create the range of numbers in an array and actually just count >> them in to different slots in an array no sorting needed. <snip> > Can not just anyone tell me if this is a known sorting algorithm or > even sorting,
Yes, it is wellknown. There are also slightly more general versions like radix sort that remove the restriction on the range of the values being sorted.
> i do understand that it is faster then other known > algorithms, but maybe not practical, what is the disadvantages of this > approach?
It is practical is some cases and not in others. The main disadvantage is that it only works for sorting integers in a range that can be used to index an array, and it will be slower than many other algorithms even for some very short inputs.
 Ben.



