search for range with O(logn)