๐ Search
One-line summary: Locate a target within a collection โ from O(n) linear scans to O(log n) binary search on sorted data.
Algorithms in this sectionโ
Runnable implementations (with tests) live alongside this guide in this folder:
- Linear Search โ O(n), works on unsorted data
- Binary Search โ O(log n), requires sorted input
- Jump Search โ O(โn), sorted input, block jumps
- Interpolation Search โ O(log log n) average on uniformly distributed sorted data
Quick Comparisonโ
| Algorithm | Time (avg) | Requires Sorted? |
|---|---|---|
| Linear Search | O(n) | No |
| Binary Search | O(log n) | Yes |
| Jump Search | O(โn) | Yes |
| Interpolation Search | O(log log n) | Yes (uniform) |
Related Topicsโ
- Sorting โ prerequisite for binary/jump/interpolation search
- Binary Search โ problem-set applications of binary search
โ Back to Home ยท ยฉ sparshjaswal