Re: sort algorithm



Limbo wrote:
i have an array of size 100000000 (100M) that was randomaly
initialized with numbers (0-100)
now, i wrote a function that sort this array in 1500 ms.
its sorts an array of 10M in 140 ms, an array of 1M in 16 ms.
my question is, is this function performance ok?
what is the Big O of this function.
is there a better function to do the same?

The best sorting algorithm for that specific case is counting sort, as
it's a linear-time sorting algorithm (ie. O(n)).
.



Relevant Pages

  • Re: Help on best way to gather/sort results ?
    ... So I do have another question on my sort. ... puts Time.now - t ... This may be due to the creation of addition Array objects within the block. ... the sorting algorithm against those values. ...
    (comp.lang.ruby)
  • Re: sort algorithm
    ... i wrote a function that sort this array in 1500 ms. ... is this function performance ok? ... 100,000,000 entries: 650ms ...
    (comp.programming)
  • Re: Two dimensional sort
    ... > I have a two arrays that I wish to sort. ... One is the index array (full ... Dim i as Integer ... This is NOT a complete sorting algorithm. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Sorting arrays
    ... How to apply the sorting algorithm to your app. ... It would seem that he is able to sort by score just fine, ... To the OP, Miikka: ... they stored in an array, ...
    (comp.lang.basic.visual.misc)
  • sort algorithm
    ... i wrote a function that sort this array in 1500 ms. ... is this function performance ok? ... tnx. ...
    (comp.programming)