binary search, hasDuplication