Binary Search

Searching & Arrays

Efficiently finds a target value in a sorted array by repeatedly dividing the search interval in half.

500ms
Click "Initialize" to set up the algorithm, then step through or auto-run.

Visualization

Complexity Analysis

Best Case O(1)
Average Case O(log n)
Worst Case O(log n)
Space O(1)

Implementation