Implement binary search.