Useful Algorithms

The standard library includes a suite of functions, which the library calls algorithms, to simplify many programming tasks that involve repeated application of operations over data ranges. The data can be a container of objects, a portion of a container, values read from an input stream, or any other sequence of objects that you can express with iterators. I’ve introduced a few algorithms when appropriate. This Exploration takes a closer look at a number of the most useful algorithms.


The standard algorithms include many flavors of searching, divided into two broad categories: linear and binary. The ...

Get Exploring C++ 11, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.