Given n integers, arranged in a line, show an efficient algorithm that can find one peak. A peak is a number that is not less than the two numbers next to it (or the one number next to it, if it’s at the end of the line.)
Given n integers, arranged in a line, show an efficient algorithm that can find
Share
An
O(log n)algorithm exists. We use divide-and-conquer.