0
Why it is showing -1?
2 Antworten
+ 2
Change the conditions
if(arr[mid]>t)
end=mid-1;
else
if(arr[mid]<t)
start=mid+1;
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