How to find the smallest element in rotated sorted array?

Input 1: array[]={4,5,6,7,8,9,1,2,3};
Output : position of smallest element means here 6 (array starts from zero).

Input 2: array[]={1,2,3,4,5,6,7,8,9};
Output : position of smallest element means here 0 (array starts from zero).
Click for Solution
[Insert Code]