Algorithm-MinMax
view release on metacpan or search on metacpan
if( $max_cand[ $i ] > $m ) {
$m = $max_cand[ $i ];
}
}
$result[ 1 ] = $m;
@result;
}
1;
__END__
# Below is stub documentation for your module. You better edit it!
=head1 NAME
Algorithm::MinMax - Finding the minimum and maximum of an array with
at most 3n/2 - 2 comparisons.
=head1 SYNOPSIS
use Algorithm::MinMax;
@a = ( 3, 2, 5, 4, 8, 9 );
( run in 0.352 second using v1.01-cache-2.11-cpan-de7293f3b23 )