Advertisement
STANAANDREY

T10/6/2020 2

Oct 6th, 2020 (edited)
923
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int binSrc(int v[], int p, int q, int x) {
  5.     if (p > q)
  6.         return -1;
  7.     int mid = (p + q) / 2;
  8.     if (v[mid] == x)
  9.         return mid;
  10.     return x > v[mid] ? binSrc(v, p, mid - 1, x) : binSrc(v, mid + 1, q, x);
  11. }
  12.  
  13. int main() {
  14.     //driver code comes here
  15.     return 0;
  16. }
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement