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
Big O Notation
A mathematical notation that describes the upper bound of an algorithm's time or space complexity as input size grows. Common complexities from fastest to slowest: O(1), O(log n), O(n), O(n log n), O(n^2), O(2^n).
RecursionA technique where a function calls itself to solve smaller instances of the same problem. Every recursive function needs a base case (stopping condition) and a recursive case. Common in tree traversals, divide-and-conquer algorithms, and mathematical computations.