Binary Search Algorithm
Just a BS(bulls**t) algorithm, nothing special
int binaryS (int[] array, int key, int min, int max) {
if (max < min) {
return -1;//can’t find
}
int mid = (min + max) / 2;
if (array[mid] > key) {
return binaryS(array, key, min, mid-1);
} else if (array[mid] < key) {
return binaryS(array,key, mid+1, max);
} else {
return mid;
}
}