Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int Search_1(int x, int y){
- if(v[x] == val) {
- Z = x;
- if(x + y != x)
- return Search_1(x + y, y / 2);
- } else if(x + y == x && v[x]!=val) {
- return -1;
- } else {
- if(val>v[x])
- return Search_1(x + y, (x+y) / 2);
- else if (val<v[x])
- return Search_1(x - y, (x-y) / 2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement