Re: sort algorithm
- From: Richard Heathfield <rjh@xxxxxxxxxxxxxxx>
- Date: Thu, 31 Jul 2008 14:55:50 +0000
Limbo said:
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?
My results are:
100,000,000 entries: 650ms
10,000,000 entries: 63ms
1,000,000 entries: 5ms
(AMD Athlon 1.4GHz). Compare and contrast, depending on your processor. If
you're doing this on a 286 with seventeen bytes of RAM, your results rock
and you should publish or patent. If you're doing it on a Cray, though, go
back to school. :-)
what is the Big O of this function.
Mine is O(n). Yours looks O(n)-ish, too.
is there a better function to do the same?
I used bucket-sort. For this application, I heartily recommend it.
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
.
- Follow-Ups:
- Re: sort algorithm
- From: Juha Nieminen
- Re: sort algorithm
- References:
- sort algorithm
- From: Limbo
- sort algorithm
- Prev by Date: Re: sort algorithm
- Next by Date: Re: Distance point <=> straight line in space
- Previous by thread: Re: sort algorithm
- Next by thread: Re: sort algorithm
- Index(es):
Relevant Pages
|