TC - O(log(n))
Binary Search in an array :
- Find an element
- Find the float or ceil of the element
Note: Here the array may consists of numbers or alphabets.
Binary search in a matrix:
- Matrix is sorted row wise
- Matrix is sorted row and col wise
Rotated sorted array:
- Find pivot or min point in rotated sorted array or number of times array was rotated ( With or Without Duplicates)
- Search for an element in rotated sorted array
Sorted array with duplicates
- Find 1st and last occurance of any element in a sorted array
Infinite length sorted array
- Search in Infinite sorted array
- Find the Index of 1st one in an infinite length binary array
Bitonic array
- Max element in bitonic array
- Search in bitonic array
Misc
- Square root of X using Binary search
- Peak Element