Algomination
Data Structures
AboutContact

Algomination

Learn algorithms and data structures through smooth, interactive visualizations.

SortingSearchingArray AlgorithmsData StructuresAboutContact

© 2026Algomination. Created by Omang Rawat & Rahul Soni.

Omang Rawat
Rahul Soni
All searching algorithms

Binary Search

Time O(log n)Space O(1)

Repeatedly halves a sorted range, checking the middle element against the target.

Binary search requires sorted data — your array is sorted automatically before searching.

1
3
5
7
9
11
13
15
Binary Search needs sorted data — array sorted. Searching for 9.
Step 1 / 7
Sub-arrayComparingFound

About Binary Search

Repeatedly halves a sorted range, checking the middle element against the target.

Time complexity: O(log n). Space complexity: O(1).

How it works, step by step

Core idea — On sorted data, compare the target to the middle element and throw away the half it can't be in.

What each pass accomplishes — Each step checks the middle of the current range and discards half the remaining elements, so the search space halves every iteration — n elements are exhausted in about log₂(n) steps.

Use the interactive visualizer above to run Binary Search on your own input and watch every comparison, swap, and operation animate step by step — pause, scrub, or replay at any speed.