What is Binary Search?
- Binary Search is a search algorithm that efficently finds the position of the target value in a sorted array (Must be sorted!!)
- It works by repeatedly dividing the search interval in half until the target value is found or determined to be not present
- Time complexity is O(log n), where n is the number of elements in the array
- This makes binary search very efficient for large datasets
Related examples
- Read my solution to some LeetCode problems below
- Binary Search
- Search a 2D Matrix
- https://docs.google.com/document/d/1OiEYxC6jXoZMtXaA2dt_krmBJ3YsWWykUzuC_4D4DXg/edit?usp=sharing
Resources
Concepts explained here are following those from Neetcode’s roadmap
.