Binary Search
The short answer · 15 words
In short
Search algorithm that narrows the search area in a sorted data set by repeated halving.
Flow-alerta.cab (2026): Binary Search. https://flow-alerta.cab/en/glossar/binary-search. Editorially reviewed on: 09 October 2026.
How much detail would you like?
Practical
Basic algorithm for efficient search in sorted data structures. It also illustrates the difference between linear and logarithmic scaling.
Example scenario: A sorted list of millions of numerical IDs searches for a value without a complete run through the list.
Use large sorted data sets and direct index access; in databases, index structures usually take over the practical search optimization.
At a glance
- Core
- Binary search compares the searched value to the middle element of a sorted sequence. Depending on the comparison, only the left or right half is searched further. As a result, the number of necessary comparisons only increases logarithmically with the input size.
- Use
- Basic algorithm for efficient search in sorted data structures. It also illustrates the difference between linear and logarithmic scaling.
- Example
- Example scenario: A sorted list of millions of numerical IDs searches for a value without a complete run through the list.
- Limits
- Apply to unsorted data; use off-by-one errors at limits; use inappropriate data structure with slow instant access; confuse O(log n) with constant runtime.
In context
Questions about this term
Do the data have to be sorted?
For classic binary search yes.
How does it scale?
Typically O(log n).
Is it always faster than linear search?
Not for every small input and data structure.
All details and background
Binary search compares the searched value to the middle element of a sorted sequence. Depending on the comparison, only the left or right half is searched further. As a result, the number of necessary comparisons only increases logarithmically with the input size.
ELI5 – Explained simply
As with the dictionary: You strike approximately in the middle and decide whether you have to search further forward or further backwards.
Why it matters in practice
Basic algorithm for efficient search in sorted data structures. It also illustrates the difference between linear and logarithmic scaling.
Example
Example scenario: A sorted list of millions of numerical IDs searches for a value without a complete run through the list.
Pitfalls and limits
- Apply to unsorted data; use off-by-one errors at limits; use inappropriate data structure with slow instant access; confuse O(log n) with constant runtime.
Origin & history
The NIST dictionary describes binary search as repeatedly halving a sorted search area.
Use in mid-sized companies
- Use large sorted data sets and direct index access; in databases, index structures usually take over the practical search optimization.
Related terms
- O-Notation
- Search algorithm
Matching Flow-alerta service
Websites & web applicationsWebsites & web applications: technical implementation and testing of a suitable web application.Matching tool / use case
View use casesUse Case: efficient search in a large sorted list of values.Sources
- xlinux.nist.govNIST Dictionary of Algorithms and Data Structures, binary search
Quellenprüfung: 09.10.2026. Definition und dokumentierte Einordnung abgeglichen; Beispiele beschreiben mögliche Anwendungen.
Editorially reviewed on: