instagram

Find a peak element in an array

This algorithm to find peak element in an array, Peak element is an element which has greater value than its left and right element.

one way to get peak element is using linear search which takes O(n), but we can also search using binary algo.

Lets see algorithm directly.

Algorithm

Share