Binary Search
Binary Search
Narrow a sorted range by half at each step to find a target in O(log n).
target
low=0, high=10, mid=5 → arr[5]=23
L
2
05
18
212
316
4M
23
538
645
756
872
9H
91
10Step 0/1
Binary Search
Narrow a sorted range by half at each step to find a target in O(log n).