Class: IntervalTree

data-structures/interval-tree. IntervalTree

Constructor

new IntervalTree()

Interval tree.
Source:

Members

root :Node

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

Methods

add(intreval)

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

contains(point) → {Boolean}

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

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

findMax(node) → {Node}

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

height() → {Number}

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

intersects(interval) → {Boolean}

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

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

remove(intreval)

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