Advanced Binary Search
Complex applications of binary search for solving optimization and search problems.
Search in 2D matrix
- Sorted 2D Matrix: Search in matrix sorted row-wise and column-wise
- Row-wise Sorted: Matrix sorted only row-wise
- Column-wise Sorted: Matrix sorted only column-wise
- Spiral Matrix: Search in spiral-ordered matrix
Search in infinite array
- Unbounded Search: Search in array of unknown size
- Exponential Search: Start with small range and double it
- Binary Search on Range: Apply binary search once range is found
- Streaming Data: Search in continuously growing data
Peak finding
- 1D Peak: Find peak element in 1D array
- 2D Peak: Find peak element in 2D matrix
- Local Peak: Find any local maximum
- Global Peak: Find global maximum
Square root & power
- Square Root: Find square root of number
- Nth Root: Find nth root of number
- Power Function: Implement power function efficiently
- Modular Exponentiation: Power with modular arithmetic
Search with conditions
- First True: Find first element satisfying condition
- Last False: Find last element not satisfying condition
- Custom Predicate: Search with custom boolean function
- Optimization Problems: Find optimal value using binary search