IntervalTree

data-structures/interval-tree. IntervalTree

new IntervalTree()

Interval tree.
Source:

Members

root :Node

Root node of the tree.
Source:
Type:
  • Node

Methods

add(intreval)

Add new interval to the tree.
Source:
Parameters:
Name Type Description
intreval Array Array with start and end points of the interval.

contains(point) → {Boolean}

Checks or point belongs to at least one intarval from the tree.

Complexity: O(log N).
Source:
Parameters:
Name Type Description
point Number Point which should be checked.
Returns:
Type:
Boolean
True if point belongs to one of the intervals.

findMax(node) → {Node}

Returns node with the max endpoint in subtree.
Source:
Parameters:
Name Type Description
node Node Root node of subtree.
Returns:
Type:
Node
Node with the largest endpoint.

height() → {Number}

Returns height of the tree.
Source:
Returns:
Type:
Number
Height of the tree.

intersects(interval) → {Boolean}

Checks or interval belongs to at least one intarval from the tree.

Complexity: O(log N).
Source:
Parameters:
Name Type Description
interval Array Interval which should be checked.
Returns:
Type:
Boolean
True if interval intersects with one of the intervals.

remove(intreval)

Remove interval from the tree.
Source:
Parameters:
Name Type Description
intreval Array Array with start and end of the interval.