Описание тега interval-tree

Interval-tree allows one to efficiently find all intervals that overlap with any given interval or point

In computer science, an interval tree is an ordered tree data structure to hold intervals.

It allows one to efficiently find all intervals that overlap with any given interval or point. It is often used for windowing queries, for instance, to find all roads on a computerized map inside a rectangular viewport, or to find all visible elements inside a three-dimensional scene. A similar data structure is the segment tree.

Queries require O(log n + m) time, with n being the total number of intervals and m being the number of reported results. Construction requires O(n log n) time, and storage requires O(n) space.