why this code is not working
Pivot__sorted and rotated array
hi @sp5513
- Find middle point mid = (l + h)/2
- If key is present at middle point, return mid.
- Else If arr[l…mid] is sorted
a) If key to be searched lies in range from arr[l] to arr[mid], recur for arr[l…mid].
b) Else recur for arr[mid+1…r] - Else (arr[mid+1…r] must be sorted) .
a) If key to be searched lies in range from arr[mid+1] to arr[r], recur for arr[mid+1…r].
b) Else recur for arr[l…mid]
refer this code -->
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.