Binary Search Visualizer

Learn Search Algorithms

Visualize how binary search efficiently finds elements in a sorted array by repeatedly dividing the search interval in half.

Visualization

Color Legend

Default
Left (L)
Right (R)
Middle (M)
Found
Excluded

Complexity

Time Complexity
O(log n)
Space Complexity
O(1)
Best Case
O(1) - Element at middle
Worst Case
O(log n) - Element not found

How It Works

  1. Start with sorted array
  2. Find middle element
  3. Compare with target
  4. If equal, found!
  5. If less, search right half
  6. If greater, search left half
  7. Repeat until found or exhausted