Driver code to test above methods
int main ( ) { int arr [ ] = { 3 , 4 , 3 , 5 , 2 , 3 , 4 , 3 , 1 , 5 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; int idxOfEle = 5 ; cout << getIndexInSortedArray ( arr , n , idxOfEle ) ; return 0 ; }