dsa1 min read
Sqrt(x) — Right Boundary Binary Search
Compute integer square root using right-boundary binary search to find the largest k where k*k <= x.
Read →
webcoderspeed.com
1276 articles
Compute integer square root using right-boundary binary search to find the largest k where k*k <= x.
Find the starting and ending positions of a target in a sorted array using two separate binary searches.
Search in a rotated sorted array by identifying which half is sorted and narrowing accordingly.
Find the minimum element in a rotated sorted array by comparing mid with right boundary to locate the rotation point.
Search a row-column sorted 2D matrix in O(log(m*n)) by treating it as a virtual 1D sorted array.