int bsearchWithoutRecursion(int array[],int low,int high,int target) { while(low<=high) { int mid=(low+high)/2; if(array[mid]>target) high=mid-1; else if(array[mid]<target) low=mid+1; else return mid; } return-1; }
int bsearchWithoutRecursion(int array[],int low,int high,int target) { while(low<=high) { int mid=(low+high)/2; if(array[mid]>target) high=mid-1; else if(array[mid]<target) low=mid+1; else return mid; } return-1; }