Skip to content

Glossary: Data Structures and Algorithms in C++

Off-by-one error

Also written: off-by-one

A mistake of exactly one in an index or comparison. Binary search's classic ones are `low < high` instead of `<=`, and `low = middle` instead of `middle + 1`.

Where the book teaches it

Related terms

Binary search