what if he gave input like 4,2,1,5,3 then code given in video will it works?
Help rahul pivot element -binary search
no this logic only works for a sorted array which is rotated
sir what if we sort array again and then apply binary search? was there nay restriction on sorting the array again
If you sort the array you will lose the original position of the elements. So your answer will be wrong
can’t we use linear search here? that will only n repeptitions and simple aslo
Time complexity of linear search -O(n) , Binary search has time complexity O(log n). but linear search will give you the answer too