public int binarySearch(int arr[], int find)
{
int low = 0, high = arr.length - 1, mid = 0;
while(low <= high)
{
mid = (low + high) / 2;
if(arr[mid] == found) return mid;
else if(arr[mid] > found) high = mid - 1;
else low = mid + 1;
}
return -1;
}
1 comment:
Hahaha..
Rindu kt mohan ke???
Post a Comment