Skip to content

Binary Search Visualizer

Visualize binary search algorithm step by step

Updated

What is the Binary Search Visualizer?

How it works

Examples

Finding a Target in a Sorted Array

Array: [1, 3, 5, 7, 9, 11, 13, 15, 17, 19], Target: 7
Found at index 3 in 2 iterations and 2 comparisons.

Searching for the First Occurrence (Duplicates)

Array: [1, 2, 4, 4, 4, 4, 6, 8, 10], Target: 4, Mode: First
Found at index 2 after narrowing down the left half.

Target Not Present in Array

Array: [10, 20, 30, 40, 50, 60], Target: 25
Not found (-1). Search exhausted after 3 comparisons.

Frequently asked questions