comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Bizarre slowness from sort()
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Bizarre slowness from sort() [message #30446 is a reply to message #30444] Tue, 23 April 2002 12:58 Go to previous messageGo to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Jonathan Joseph wrote:
>
> I had the following enlightening discussion about qsort with a
> programmer from RSI who responded to my post, but I'm still not
> entirely convinced. Can anyone comment on this?

From Jon Bentley's "Programming Pearls", 2nd Ed, pg 119 (describing qsorts and their
efficiency):

"The qsort1 [code snippet in his book] function quickly sorts an array of random integers, but
how does it perform on nonrandom inputs? ..... consider an extreme case: an array of n
identical elements. .... the total run time is O(n^2). The run time for n=1000000 jumps from a
second to two hours."

There is also discussion of a bunch of nifty things one can do to speed up sorting. The code
snippets are only about 10-15 lines long so it would be not to difficult to translate from the
C code into IDL (I think).

Probably worth it if you or your colleague will be sorting the offending type of input data.

paulv

--
Paul van Delst Religious and cultural
CIMSS @ NOAA/NCEP purity is a fundamentalist
Ph: (301)763-8000 x7274 fantasy
Fax:(301)763-8545 V.S.Naipaul
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: 24-bit color problem on Red Hat Linux 7.1
Next Topic: ENVI Convert Arcview registration problems

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 16:58:14 PDT 2025

Total time taken to generate the page: 0.00182 seconds