Sunday, March 2, 2014

Find the pivot element in the rotated sorted array

A sorted array is rotated around a pivot element. Find the pivot element in the rotated sorted array.
 
Analysis

Lets start with an example
Original array:           2, 4, 6, 8, 9, 10, 12, 15
Rotated array:           10, 12, 15, 2, 4, 6, 8, 9
Output:                      3