Segment Tree Algorithm

In computer science, a segment tree, also known as a statistic tree, is a tree data structure used for storing information about intervals, or sections. I of N intervals uses O(n log N) storage and can be build in O(n log N) time. The segment tree was invented by Jon Louis Bentley in 1977; in" solution to Klee ’s rectangle problems".

Segment Tree source code, pseudocode and analysis