Ternary search

A ternary search algorithm[1] is a technique in computer science for finding the minimum or maximum of a unimodal function.

Assume we are looking for a maximum of

{\displaystyle f(x)}

and that we know the maximum lies somewhere between

For the algorithm to be applicable, there must be some value

be a unimodal function on some interval

Take any two points

in this segment:

Then there are three possibilities: choice points