Step 1/0
Custom array:
Complexity
Best:O(1)
Average:O(log n)
Worst:O(log n)
Space:O(1)
Description
On a sorted array, repeatedly halves the search space by comparing the target with the middle element.
When to use
O(log n) search for sorted arrays. Use when the data is sorted and searches are frequent (libraries, databases, competitive programming).