Overview
Peak Finding is a search method that uses ordering, indexing, predicates, or distance bounds to eliminate candidates. It is a good fit when the collection has enough structure to avoid checking every candidate.
Peak Finding uses ordering or monotonic structure to eliminate candidates.
Compact metadata for implementation and discovery.
Peak Finding is a search method that uses ordering, indexing, predicates, or distance bounds to eliminate candidates. It is a good fit when the collection has enough structure to avoid checking every candidate.
Quick facts
Runtime and memory behavior at a glance.
Best
O(1)
Average
O(log n)
Worst
O(n)
Space
O(1)
if a[mid] < a[mid + 1], search right; otherwise search leftMoves toward a neighbor that proves a peak exists on that side.
Show candidate regions shrinking as comparisons or distance tests eliminate options.
Peak Finding operates in O(log n) time and O(1) space within the Search family. Key governing relation: if a[mid] < a[mid + 1], search right; otherwise search left. Often compared with Binary Search and Linear Search.
What each reference supports for this entry.
Textbook support for Peak Finding invariants, recurrences, relaxation rules, or asymptotic analysis.
Open sourceGood next jumps from the relationship graph, ranked for useful discovery.
Peak Finding and Binary Search address nearby searching problems but make different implementation tradeoffs.