101 Logo
onenoughtone

Interactive Binary Search Visualization

Standard Binary Search

Watch how binary search efficiently finds a target value in a sorted array by repeatedly dividing the search space in half.

Interactive Visualization:

Standard Binary Search Visualization
Target:
23
2
0
left
5
1
8
2
12
3
16
4
23
5
38
6
45
7
56
8
72
9
91
10
right

Step 0 of 4: Initial state

Finding First Occurrence

See how binary search can be modified to find the first occurrence of a target value in a sorted array with duplicates.

Interactive Visualization:

First Occurrence Binary Search Visualization
Target:
23
2
0
left
5
1
5
2
5
3
8
4
12
5
16
6
23
7
23
8
23
9
38
10
45
11
56
12
72
13
91
14
right

Step 0 of 18: Initial state

Rotated Sorted Array

Explore how binary search can be adapted to search in a rotated sorted array.

Interactive Visualization:

Rotated Sorted Array Binary Search Visualization

Note: The array is rotated at index 0 (value 38). This means the original sorted array was split at this point and the second part was moved to the beginning.

Target:
16
38
0
left
45
1
56
2
72
3
91
4
2
5
5
6
8
7
12
8
16
9
23
10
right

Step 0 of 14: Initial state

IntroVisualizePatternsPractice
101 Logo
onenoughtone