Data Structures

Binary Search

Definition

An efficient O(log n) search algorithm that works on sorted arrays by repeatedly dividing the search interval in half. Compare the target to the middle element and eliminate half the remaining elements each step.

Code Example

Javascript
Tip: Modify the code above and click “Run” to see the results

Learn More

Related Terms