use binary search to lower complexity