[thelist] Programming - Finding Largest Value
Joshua Olson
joshua at waetech.com
Wed Mar 20 08:32:02 CST 2002
----- Original Message -----
From: "Erik Mattheis" <gozz at gozz.com>
Sent: Wednesday, March 20, 2002 9:19 AM
Subject: Re: [thelist] Programming - Finding Largest Value
> >Or can anyone suggest another means to find the largest value of a group?
>
> Put them in an array and use Array.sort()
Erik, et al.
As tempting as that sounds, I'd avoid that solution. A simple iteration runs
in linear time--aka O(n). Twice as many elements = twice the time. A sort
runs in worse time, even for the best algorithm. The best sort algorithm
(used for a generalized case) can run no better than O(n log n) time. That
is *worse* than linear.
For info on the big-o notation:
http://www.nist.gov/dads/HTML/bigOnotation.html
-joshua
More information about the thelist
mailing list