Ternary Search
SearchingMediumDivide search bounds into three parts to isolate targets or unimodal peak boundaries.
Alt+Shift+T
Configuration Panel
Three-way Range Divisions Visualizer
50
81
122
163
234
385
566
727
Time Complexity
O(log3 N) branching divisions
Space Complexity
O(1) auxiliary variables
Conceptual Overview
Ternary Search divides the search space into three equal segments by evaluating two midpoints (mid1 and mid2) instead of one, running in logarithmic time.
Algorithm Idea
Divide the interval [low, high] into three equal parts. Compare the target to mid1 and mid2 to eliminate 1/3 or 2/3 of the search space.
Stable Sorting
N/A
In-place Memory
N/A
Source: CP-Algorithms search & sorting reference