two ways to do the binary search