Skip to main content

Concept

Binary Search is an efficient algorithm for searching through sorted lists.

Instead of searching through a list one by one, it entails narrowing down your search range by half each iteration.

Example

Problem: Find the index of 5551 in the following list.

Time & Memory Complexity

Time Complexity: O(logn)

Memory Complexity: Depends on implementation method