Data Structure for Storing Ranges
问题 I am wondering if anyone knows of a data structure which would efficiently handle the following situation: The data structure should store several, possibly overlapping, variable length ranges on some continuous timescale. For example, you might add the ranges a:[0,3], b:[4,7], c:[0,9] . Insertion time does not need to be particularly efficient. Retrievals would take a range as a parameter, and return all the ranges in the set that overlap with the range, for example: Get(1,2) would return a