0 0 votes An array with n distinct element In array till ith position elements are in increasing order after ith position elements are in decreasing order time Complexity to find i A.O(nlogn) B.O(logn) C.O(n) D.O(loglogn) Algorithms algorithms time-complexity + – Abhisek Tiwari 4 688 views answer comment Share Follow Print See all 4 Comments 4 4 Comments reply Soumya Tiwari commented Nov 28, 2018 reply Follow flag Option B? 1 1 replyShare kumar.dilip commented Nov 28, 2018 reply Follow flag It will take just O(log n) time. Just modify the binary search Algorithm. 2 2 replyShare Abhisek Tiwari 4 commented Nov 28, 2018 reply Follow flag @Soumya Tiwari @kumar.dilip Yes Ans is logn how? 0 0 replyShare kumar.dilip commented Nov 28, 2018 reply Follow flag Check out this code.(Binary search) #include <stdio.h> int main() { int arr[]={1,2,3,10,20,10,0,-1,-3}; int low=0,high=10; int i= findpos(arr,low,high); printf("%d\n",i); return 0; } int findpos(int *p,int a,int b) { int mid=(a+b)/2; if(p[mid-1]<p[mid]) { if(p[mid]<p[mid+1]) return findpos(p,mid+1,b); else return mid; } else return findapos(p,a,mid); } 1 1 replyShare Please log in or register to add a comment.