augmentedRedBlackIntervalIndex<
K,V>(order,initialEntries?):IntervalIndex<K,V>
Defined in: packages/interval-index/src/augmented-red-black-interval-index.ts:17
Create an interval index backed by a red-black tree keyed by (start, id), each node augmented with the largest
end in its subtree, plus a map from id to node.
add and delete take O(log n) time and has and get O(1). atPoint and overlapping reporting k entries
take O(min(n, (k + 1) log n)) time: a subtree is skipped when its largest end sorts before the query start, and the
walk stops at the first start past the query end. A full walk takes O(n). Space is O(n).
Type Parameters
Section titled “Type Parameters”K
V
Parameters
Section titled “Parameters”Order<K>
initialEntries?
Section titled “initialEntries?”Iterable<IntervalInput<K, V>, any, any>
Returns
Section titled “Returns”IntervalIndex<K, V>
Throws
Section titled “Throws”With INVALID_INTERVAL when an initial entry’s start sorts after its end.
Cormen, Leiserson, Rivest, and Stein, Introduction to Algorithms, 3rd ed., section 14.3, “Interval trees”.