Simplify the binary search logic to incorporate 0 and 1 in it.