.\" ident @(#)Array_alg:man/minimum.3 3.2 .\" .\" C++ Standard Components, Release 3.0. .\" .\" Copyright (c) 1991, 1992 AT&T and UNIX System Laboratories, Inc. .\" Copyright (c) 1988, 1989, 1990 AT&T. All Rights Reserved. .\" .\" THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T and UNIX System .\" Laboratories, Inc. The copyright notice above does not evidence .\" any actual or intended publication of such source code. .\" .TH \f3minimum\fP \f3Array_alg(3C++)\fP " " .SH NAME minimum \- find the smallest element in an array .SH SYNOPSIS OF Array_alg.h .Bf template const \*(gt* minimum(const \*(gt* b,const \*(gt* e); template const \*(gt* minimum_r(int (*rel)(const \*(gt*,const \*(gt*), const \*(gt* b,const \*(gt* e); .Be .SH ASSUMPTIONS .PP (1) For the plain version, \*(gt\f4::operator<\f1 defines a total ordering relation on \*(gt .br (2) For the relational version, \f4rel\f1 defines a total ordering relation on \*(gt. .SH DESCRIPTION .PP These functions return a pointer to the leftmost instance of the smallest element in the array. If the array is empty (\f4b >= e\f1), the value of \f4e\f1 is returned as the function result. .sp 0.5v .IP "\f4template \f1" .IC "\f4const \*(gt* minimum(const \*(gt* b,const \*(gt* e);\f1" Uses \f4\*(gt::operator<\f1 to find the smallest element. .IP "\f4template \f1" .IC "\f4const \*(gt* minimum_r(int (*rel)(const \*(gt*,const \*(gt*),const \*(gt* b,const \*(gt* e);\f1" Uses \f4rel\f1 to find the smallest element. .SH COMPLEXITY .PP If \f2N\f1 is the size of the array, then complexity is \f2O(N)\f1. Exactly \f2N\-1\f1 tests of the ordering relation are done. .SH NOTES Because a Block (see \f3Block(3C++)\f1) can always be used wherever an array is called for, Array Algorithms can also be used with Blocks. In fact, these two components were actually designed to be used together. .SH SEE ALSO .Bf \f3intro(.)\f1 \f3Block(3C++)\f1 .Be