{
  "schema_version": "1.0",
  "codex": "thecodex.expert/coding",
  "type": "algorithm",
  "slug": "algorithms/searching/binary-search",
  "name": "Binary Search",
  "confidence": "high",
  "last_verified": "2026-06-01",
  "url": "https://thecodex.expert/coding/algorithms/searching/binary-search/",
  "canonical_definition": "Binary search is an algorithm that locates a target value in a sorted array by repeatedly halving the search space \u2014 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"
  },
  "concept_relationship": {
    "requires_first": [
      "data-structures/arrays",
      "algorithms/complexity"
    ],
    "enables": [
      "data-structures/binary-search-trees"
    ]
  },
  "sources": [
    {
      "num": 1,
      "citation": "Knuth TAOCP Vol.3 \u00a76.2.1",
      "tier": 1
    },
    {
      "num": 2,
      "citation": "CLRS 4th ed. \u00a72.3.5",
      "tier": 1
    },
    {
      "num": 3,
      "citation": "Bottenbruch 1962 JACM 9(2)",
      "tier": 1
    },
    {
      "num": 4,
      "citation": "Python bisect module docs",
      "tier": 1
    }
  ]
}