On 30 Aug 2002, Felix Geerinckx wrote:

> This if for a seven-element array. 
> 
> I did some testing myself for larger array sizes (times are in 
> CPU seconds):
> 
>       Size   Loop  Sort
>       1000   0.00  0.01
>      10000   0.02  0.08
>     100000   0.13  1.03
>     200000   0.24  2.18
>     300000   0.37  3.35
> 
> So if you have more than 1000 numbers, the loop method will already
> be faster. In addition, it has the advantage that you don't need all
> the numbers to be present in memory, since you can calculate min/max
> while you read the numbers from file. 
> 
> For small array sizes, it doesn't matter which method you use, since 
> the cpu time will be near zero anyway. For larger sizes it does 
> matter, and the loop method is a clear winner.
> Therefor, imho, your suggestion in March (and mine now :-) to use a 
> loop, is *always* preferable.

I thought on similar lines too when that thread was on, but I convinced 
myself saying that an unsorted array of 1000 or more elements in your 
code is a poor design to start with :-)





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to