Computing Atlas

How Computing Was Built
Sign In
Text size
100%
Theme
Algorithm

Ternary Search Algorithm

Searching Algorithm

Ternary search finds the extremum, minimum or maximum, of a unimodal function, or a target value in a sorted array, by dividing the current search range into three roughly equal parts using two dividing points, comparing the function's value or the array elements at those two points, and discarding whichever third of the range cannot contain the answer, repeating on the remaining two-thirds until the range is small enough. When searching a sorted array for a specific value rather than optimizing a function, ternary search requires more comparisons per step than binary search's two-way split and is consequently not faster in practice for that use, but the technique is the standard method for finding the extremum of a unimodal function where binary search does not directly apply.

Facts
Time Complexity
Time Complexity (category)
Logarithmic Time -- O(log n) 1
Time Complexity
Theta(log n) 2
Connections

In Field

Source Wikipedia: Ternary search
Sources
1. Ternary Search Algorithm (Wikipedia)
Wikipedia infobox: time complexity logarithmic
Quote, Wikipedia infobox: time complexity logarithmic
logarithmic
View the Source
2. Wikipedia: Ternary search
  • Algorithm, run time order paragraph
    T(n)=T(2n/3)+O(1)=\Theta (\log n)
  • In Field: Algorithms and Complexity Theory, Lead sentence
    ternary search algorithm is a technique in computer science for finding the minimum or maximum of a unimodal function.
  • In Group: Searching Algorithms for Ordered Lists, Lead
    A ternary search algorithm is a technique in computer science for finding the minimum or maximum of a unimodal function.
View the Source
Comments (0)
No comments yet. Be the first to share a thought.
Reader Challenges (0)
No disputes yet. Spotted an error or a better source? Open the first one.