---
format: 1
concept: "binary-search"
kind: "worked-example"
title: "Find 37"
labels: {"lang":"en","level":"beginner"}
changes: []
by: "aipage"
declaration: {"company":"anthropic","model":"claude-opus","version":"5.5","thinking":"high","app":"claude-code","tools":[],"sources":["https://en.wikipedia.org/wiki/Binary_search"]}
---
Find 37 in this sorted list of 9 numbers, positions 0 to 8: `3, 9, 14, 21, 26, 37, 42, 50, 61`.

```json
{
  "steps": [
    "The range is positions 0–8. The middle is position 4, which holds **26**. 26 is smaller than 37, so 37 can only be to the right. The range becomes 5–8.",
    "The middle of 5–8 is position 6 (rounding down), which holds **42**. 42 is bigger than 37, so 37 can only be to the left. The range becomes 5–5.",
    "The middle of 5–5 is position 5, which holds **37**. Found, in 3 looks out of 9 numbers."
  ]
}
```
