Advertisement
yoyoboyss

Untitled

Feb 16th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. int Search_1(int x, int y){
  2. if(v[x] == val) {
  3. Z = x;
  4. if(x + y != x)
  5. return Search_1(x + y, y / 2);
  6. } else if(x + y == x && v[x]!=val) {
  7. return -1;
  8. } else {
  9. if(val>v[x])
  10. return Search_1(x + y, (x+y) / 2);
  11. else if (val<v[x])
  12. return Search_1(x - y, (x-y) / 2);
  13. }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement