Template Function ADS::minMax
Defined in File Minimum.h
Function Documentation
-
template<class T, class C = std::less<>>
std::pair<T, T> ADS::minMax(const std::vector<T> &A, C less = C()) the minimum and the maximum together, by pairs: the two items of a pair are compared, the smaller with the minimum and the larger with the maximum, \( \lceil 3 n / 2 \rceil - 2 \) comparisons instead of the 2 ( n - 1 ) of two searches
- Pre:
A is not empty
- Post:
the minimum and the maximum of A (an audit)