fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int binary_search(int arr[],int low,int high,int item)
  6. {
  7. while(low<=high)
  8. {
  9. int mid=(low+high)/2;
  10. if(arr[mid]==item)
  11. return mid;
  12.  
  13. if(arr[mid]>item)
  14. {
  15. high=mid-1;
  16. }
  17. else
  18. {
  19. low=mid+1;
  20. }
  21. }
  22.  
  23. return -1;
  24. }
  25.  
  26. int main()
  27. {
  28. return 0;
  29. }
Success #stdin #stdout 0s 2680KB
stdin
Standard input is empty
stdout
Standard output is empty