18th Oct 2021, 6:46 AM
Atul
Atul - avatar
2 Answers
+ 2
Change the conditions if(arr[mid]>t) end=mid-1; else if(arr[mid]<t) start=mid+1;
18th Oct 2021, 7:01 AM
Atul [Inactive]
0
if you search start..mid [1,3| ] numbers 3<5 so you have to search start=mid+1 [ |5,6] but you do end=mid-1 instead [1| ] next start=0 and end=-1 and loop ends unsucess
18th Oct 2021, 11:21 AM
zemiak