Search⌘ K

Solution Review: Cyclically Shifted Array

Explore how to apply binary search to locate the smallest element in a cyclically shifted array. This lesson guides you through the algorithm's steps, including reducing the search space and implementing the solution in Python, enhancing your understanding of binary search applications.

We'll cover the following...

Let’s reiterate the problem statement from the previous challenge.

You are required to write a function that determines the index of the smallest element of the cyclically shifted array.

An array is “cyclically shifted” if it is possible to shift its entries cyclically so that it becomes sorted.

Algorithm

Now we need to come up with a strategy to eliminate parts of the search space. Have a look at the slides ...