Minimize the if statements in binary search insert