Why these 2 codes are not working?
Why these 2 codes are not working?
@cbcao263
The given input array is not sorted. you can’t apply binary_search() over unsorted function.
So please sort the given array first.
I have changed in both, Now Please check that.
@cbcao263
In first code, there are few mistake
- line 14 should be s=mid+1;
- line 18 should be e=mid -1;
- you have not taken input q. Just write cin>>q; after line 37
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.