In the C++ Standard Library, algorithms are components that perform algorithmic operations on containers and other sequences.

The C++ standard provides some standard algorithms collected in the <algorithm> standard header. A handful of algorithms are also in the <numeric> header. All algorithms are in the namespace.

Algorithm (C++)

Categories of algorithms

The algorithms in the C++ Standard Library can be organized into the following categories. Non-modifying sequence operations (e.g. , , ) Modifying sequence operations (e.g. , , ) Sorting (e.g. sort, , ) Binary search (e.g. , ) Heap (e.g. , ) Min/max (e.g. , )

Algorithm (C++)

Examples

(returns an iterator the found object or , if the object isn't found) returns the greater of the two arguments finds the maximum element of a range returns the smaller of the two arguments finds the minimum element of a range

Algorithm (C++)

References

External links

C++ reference for standard algorithms

C++ Standard Library

Articles with example C++ code