Binary Search Calculator & Visualizer
Interactive step-by-step Binary Search visualizer with lower/upper range tracking and O(log n) elimination.
Binary Search
Enter your custom input data → Run the real algorithm engine → Observe step transitions.
⚙️ Customize Algorithm Input Data
Search space [0..4]. Mid index 2 (22) vs target (22).
Algorithm state rule requirement
State pointers updated
Mathematical Formula
Overview & Explanation
Binary Search searches a sorted array by repeatedly dividing the search interval in half.
How It Works
- Compare target value to the middle element of the array.
- If target equals mid element, search is complete.
- If target < mid, eliminate upper half. If target > mid, eliminate lower half.
Practical Applications
- Fast searching in sorted databases
- Finding boundaries and lower bounds
Binary Search Step Derivation
Search target 23 in [2, 5, 8, 12, 16, 23, 38, 56, 72, 91]
Pass 1
Low=0, High=9, Mid=4 (Val 16)
Pass 2
Low=5, High=9, Mid=7 (Val 56)
Pass 3
Low=5, High=6, Mid=5 (Val 23)
Frequently Asked Questions
Does Binary Search require a sorted array?
Related Calculators
Linear Search Calculator
Step-by-step Linear Search calculator checking elements sequentially in unsorted arrays.
Bubble Sort Visualizer & Step Calculator
Interactive step-by-step Bubble Sort execution visualizer with comparisons, swaps, and time complexity breakdown.
Selection Sort Visualizer & Calculator
Step-by-step Selection Sort execution visualizer tracking minimum element indices, swaps, and comparisons.