this doesn't depend on binary search.