Segment Tree
The structure of Segment Tree is a binary tree which each node has two attributes start
and end
denote a segment / interval.
_start_and_end_are both integers, they should be assigned in following rules:
The root's start _and _end
is given by
build
method.The left child of node A has
start=A.left, end=(A.left + A.right) / 2
The right child of node A has
start=(A.left + A.right) / 2 + 1, end=A.right
if start _equals to _end, there will be no children for this node.