Finding minimum

Hi!

Does anyone know a fast and simple algorithm to find the minimum of X values?

THX

Hartwig

You can find something there :
pub40.ezboard.com/fkirupa…D=23.topic

pom 0]

I hate Ezboards (but I love Supra :smiley: ). Let’s see

 Array.prototype.getMinimum = function(){
   var n,min,i;
   n = this.length;
   min = this[0 ];
   for (i=0;i<n;i++) {
                if (this[i ]<min)
                        min = this[i ];
   }
   return(min);
}

values = [37,5,8,87,-5,324,6,36,43,59];
test = values.getMinimum();
trace (test) ;

pom 0]

ily,

that prototype won’t operate on the last item of the array.

make n = this.length and it works just fine.

Thanks Supra, I will correct it !

pom 0] (il est trop fort ce Supra…)