Binary search

A searching algorithm that uses a file in which the sort key are in ascending order. The middle key in the file is examined and, depending upon whether this is less than or greater than the desired key, the top or bottom part of the file is again examined. Continuing in this way the algorithm either finds the desired record or discovers its absence from the file. Thus the algorithm treats the file is though it were a binary search tree.

Clicking on this step you can see the Create code learningstep of the algorithm.

Animation
Current movement:
Code

Everything is awesome!

int binary_search (int x[], int i, int j, int y){

if (i<=j){

int k = ;

if ( x[] = = y ) { return ; }

else if (x[] > y) {

return binary_search ( x, , , y);

}

else {

return binary_search ( x, , , y);

}

}

else { return -1; }

}

Hints

You're awesome! No need for help!