Find Bitonic Peak

In this lesson, you will learn how to find the bitonic peak using a binary search in Python.

We'll cover the following

In this lesson, we will be given an array that is bitonically sorted, an array that starts off with increasing terms and then concludes with decreasing terms. In any such sequence, there is a “peak” element which is the largest element in the sequence. We will be writing a solution to help us find the peak element of a bitonic sequence.

A bitonic sequence is a sequence of integers such that: x0<...<xk>...>xn1x_0 < ... < x_k > ... > x_{n-1} for some kk, 0 <= kk < nn

Notice that the sequence for this problem does not contain any duplicates.

For example:

    1, 2, 3, 4, 5, 4, 3, 2, 1

is a bitonic sequence. In the example above, the peak element is 5.

We assume that a “peak” element will always exist.

Let’s look at some other examples.

Get hands-on with 1200+ tech skills courses.