on Sat, 31 Aug 2002 04:30:34 GMT, [EMAIL PROTECTED] (Sudarshan
Raghavan) wrote: 

> My statement was far too general, what I should have said was to
> have a unsorted array of 1000 or more elements when your problem
> requires finding the max or min of that list is not a good design.

Again, I beg to differ. I'll use the same example (GD::Graph) to 
explain myself.

Say you want to graph a mathematical function

    y = f(x)

for 0 <= x <= 1000.

GD::Graph wants two arrayrefs, so you do:

    my ($x, $y);
    for (0..1000) {
        $x->[$_] = $_;
        $y->[$_] = f($_);
    }

To have a nice looking graph, you want to have the top/bottom 
coincide with the max/min value of your function, so you need to 
calculate ymax and ymin, which, of course, you do in the same for 
loop that generates the (x,y) pairs.

-- 
felix

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

Reply via email to