GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
MinMax(3) User Contributed Perl Documentation MinMax(3)

Algorithm::MinMax - Finding the minimum and maximum of an array with at most 3n/2 - 2 comparisons.

  use Algorithm::MinMax;
  @a = ( 3, 2, 5, 4, 8, 9 );
  @r = Algorithm::MinMax->minmax( \@a );

  # $r[0] = minimum = 2
  # $r[1] = maximum = 9

The implementation finds the minimum and maximum of a given array with at most 3n/2 - 2 comparisons, where n is the number of elements of the array.

Returns an array where the first entry is the minimum and the second entry the maximum of the given array.

If minmax is called with an empty array, minmax will also return an empty array.

Daniel Etzold, detzold@gmx.de
2003-05-27 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.