Solve Exercise 3-1: binsearch2