Searching Overview
Concepts & tradeoffs among common searching algorithms.
searchoverviewUpdated 2025-09-01
Linear vs Binary
- Linear no precondition O(n)
- Binary requires sorted O(log n)
Variants
- Binary adaptations: first/last occurrence, rotated arrays, 2D matrix
Choice
- Use hashing for average O(1) lookups when extra memory acceptable