Now i want to make this problem more clear...
binary serach algo is as:
Code:
   BinarySearch(A[0..N-1], value) {
       low = 0
       high = N - 1
       while (low <= high) {
           mid = (low + high) / 2
           if (A[mid] > value)             ///First check
               high = mid - 1
           else if (A[mid] < value)       //second check
               low = mid + 1
           else
               return mid // found
       }
       return -1 // not found
   }
In a while loop there is two check(if condition) ...You have to reduce it by one inside while loop.

Last edited by shabbir; 20Jan2009 at 12:39.. Reason: More detail / Code Blocks