Searching Algorithms Concepts | Binary Search Tricks
Leetcode study plan binary search
Template I – General – [while (low <= high)]
- Binary Search ^ | Sqrt(x) ! | Sqrt(x) 2 | Guess Number Higher or Lower |
- Search in Rotated Sorted Array *! | Search in Rotated Sorted Array II
- Find Minimum in Rotated Sorted Array * | Minimum Difference Element |
- Find First and Last Position of Element in Sorted Array / Search for a Range !
- Count number of occurrences in a sorted array |
- Ceiling of a Number | Floor of a Number | Order-agnostic Binary Search |
- Next Letter | Search in a Sorted Array of Unknown Size
Template II – [while (low < high)] other
- First Bad Version ! | Peak Index in a Mountain Array | Find Peak Element !
- Find Minimum in Rotated Sorted Array II | Find K Closest Elements
Other:
- Median of Two Sorted Arrays *! | Missing Number ! | Koko Eating Bananas ^
- Pow(x, n) ^! | Search a 2D Matrix ^ | Search a 2D Matrix II !
- Intersection of Two Arrays | Intersection of Two Arrays II !
- Find the Duplicate Number ! | Longest Increasing Subsequence !
- Count of Smaller Numbers After Self !
- Kth Smallest Element in a Sorted Matrix !
Hard:
Misc:
- Closest Binary Search Tree Value
- Valid Perfect Square | Find Smallest Letter Greater Than Target
- Search Insert Position | Find K-th Smallest Pair Distance
- Find a peak element in a 2D array | Split Array Largest Sum
- Bitonic Array Maximum | Search Bitonic Array | Rank from Stream
- Rotation Count | Rotation Count – II | Search Suggestions System |
- Sparse Search | Missing Int | Find Duplicates