binary search in one dimension