implement binary search method