[alg.binary.search.general]

# 26 Algorithms library [[algorithms]](./#algorithms)

## 26.8 Sorting and related operations [[alg.sorting]](alg.sorting#alg.binary.search.general)

### 26.8.4 Binary search [[alg.binary.search]](alg.binary.search#general)

#### 26.8.4.1 General [alg.binary.search.general]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L9395)

All of the algorithms in [[alg.binary.search]](alg.binary.search "26.8.4 Binary search") are versions of binary search and
assume that the sequence being searched
is partitioned with respect to an expression
formed by binding the search key to an argument of the comparison function[.](#1.sentence-1)

They work on non-random access iterators minimizing the number of comparisons,
which will be logarithmic for all types of iterators[.](#1.sentence-2)

They are especially appropriate for random access iterators,
because these algorithms do a logarithmic number of steps
through the data structure[.](#1.sentence-3)

For non-random access iterators they execute a linear number of steps[.](#1.sentence-4)
