Modifying the searching algorithm to make it more efficient

Reduce the time cost to search all intervals to O(log n + k)