| Find minimums in an array... [message #32536] |
Wed, 16 October 2002 11:08  |
engpcris
Messages: 4 Registered: August 2001
|
Junior Member |
|
|
Hello
I'm looking for a fonction or an algorithm who could find the X
minumun values in a array without having to use Sort (for a time
reason) or Min (updating the array everytime)
For Example in a Array of 1000 elements I want to find the 10 smallest
values.
Do you know any quick how to perfome it? (as I need to do this
operation many times in a loop)
thank you very much for your help.
Fil
|
|
|
|
| Re: Find minimums in an array... [message #32586 is a reply to message #32536] |
Tue, 22 October 2002 08:28  |
Stein Vidar Hagfors H[1]
Messages: 56 Registered: February 2000
|
Member |
|
|
JD Smith <jdsmith@as.arizona.edu> writes:
>
[..snip..]
> As always, you're mileage may vary. Check the performance on your
> equipment, using your data.
My compliments, JD!
My eyes used to glaze over whenever you reverse-index gurus touted
your stuff, but with this clear-cut example I think I've finally
gotten it! (And obviously, David has already graduated from histogram
college!)
> Also, lest everyone think I'm out to turn their code into piles of
> HISTOGRAM spaghetti: just because a fast HISTOGRAM/REBIN/REFORM
> solution exists, doesn't mean you should always use it
Some of the spaghetti might benefit from being canned in a procedure,
I'd say. Makes for meaningful programs & plenty of space to document
the [sometimes arcane] logic behind the use of the histogram function!
E.g. JDS_NSMALLEST(DATA,N).
--
------------------------------------------------------------ --------------
Stein Vidar Hagfors Haugan
ESA SOHO SOC/European Space Agency Science Operations Coordinator for SOHO
NASA Goddard Space Flight Center, Email: shaugan@esa.nascom.nasa.gov
Mail Code 682.3, Bld. 26, Room G-1, Tel.: 1-301-286-9028/240-354-6066
Greenbelt, Maryland 20771, USA. Fax: 1-301-286-0264
------------------------------------------------------------ --------------
|
|
|
|