use python
Extracted text: Let's assume a list A that contains non-repeating and unsorted list of numbers. A number A[i] is called a peak if: A[i-1]SA[i]2A[i+1]. For example in the list {5,10,20,15} the peak element is 20, and in the list {10,20,15,2,23,90,67} the peak elements are 20 and 90. If the list is empty, it should print a message stating "List is empty!" and return -1 If there's no peak element, it should print a message stating "No peak element found!" and return -1 The simplest way to find a peak element in a list is by iterating through every element and compare it with its neighbors, which will require (n) operations. You are required to find a peak by applying divide and conquer approach, which may require lesser operations. Hints: Don't sort the list. • This problem can be solved by a small variation in binary search algorithm Write a function peak () that takes a list of integers as a parameter and returns peak elements in a sorted order.
Extracted text: Sample >>> peak ([5,10,20,15]) 20 >>> peak ([10, 20,15,2,23,90,67]) 20 90