Objective : In this article we will discuss an algorithm to Find a peak element in a Given Array. We will see the recursion techniques to solve this problem.
Peak Element: peak element is the element which is greater than or equal to both of its neighbors.
Input: Array, arrA .
Output: A peak element and its index
A simple approach is to do a linear scan to a array and using few variables we can find a peak element. But the Time Complexity will be O(n) but real question is, Can we do better?
The Answer is yes, by using Binary Search techniques.
Read moreFind a peak element in a Given Array