# Binary Search
**URL:** https://thecodex.expert/coding/algorithms/searching/binary-search/
**Type:** algorithm | **Confidence:** high | **Verified:** 2026-06-01

## CANONICAL DEFINITION
Binary search is an algorithm that locates a target value in a sorted array by repeatedly halving the search space — O(log n) worst case, O(1) space.

## COMPLEXITY
- best: O(1)
- average: O(log n)
- worst: O(log n)
- space: O(1)
- prerequisite: sorted input required

## REQUIRES
data-structures/arrays, algorithms/complexity

## ENABLES
data-structures/binary-search-trees

## SOURCES
- Knuth TAOCP Vol.3 §6.2.1
- CLRS 4th ed. §2.3.5
- Bottenbruch 1962 JACM 9(2)
- Python bisect module docs

*The Codex Coding — thecodex.expert/coding/ — Free forever*
