Re: What is the algorithms of sort function and where function? [message #48161] |
Thu, 30 March 2006 17:14  |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
kuyper@wizard.net wrote:
> Daegal wrote:
>> Hi, IDLers~
>>
>> I want to know the algorithm which is used in sort and where.
>> How much fast is that functions comparing with C and Fortran functions
>> if there are similar functions in C and Fortran even if I don't know
>> that language at all.
>
> I can't answer your main question, nor the implied side issue about
> Fortran. However, I can tell you about C. The C standard library does
> contain a sorting function, called qsort(). It's name is derived from
> the QuickSort algorithm. but the standard does not require that it
> actually use that algorithm. QuickSort is not an especially
> sophisticated algorithm, but there are algorithms that are a lot
> slower, and in theory you have no guarantee that qsort() doesn't use
> one of those slower algorithms. In practice, of course, you can
> reasonably expect that it does used the QuickSort algorithm.
>
> I gather that much of IDL's source code is written in C; the SORT
> routine might use qsort().
>
Remember there isn't much "algorithm" to WHERE -- it just finds the
indices of the elements which aren't zero.
SORT uses underlying system sorting routine and can be slightly
different on the various platforms.
-Mike
|
|
|