Are interval, segment, fenwick trees the same?

后端 未结 2 1352
逝去的感伤
逝去的感伤 2020-12-30 09:42

Today i listened a lecture about fenwick trees (binary indexed trees) and the teacher says than this tree is a generalization of interval and segment trees, but my implement

2条回答
  •  再見小時候
    2020-12-30 10:15

    The following classification seems sensible although different people are bound to mix these terms up.

    Fenwick tree/Binary-indexed tree link

    The one where you use a single array and operations on the binary representation to store prefix sums (also called cumulative sums). Elements can be members of a monoid.

    Range tree link

    The family of trees where each node represents a subrange of a given range, say [0, N]. Used to compute associative operations on intervals.

    Interval tree link

    Trees where you store actual intervals. Most commonly you take a midpoint, keep the intersecting intervals at the node and repeat the process for the intervals to the left and to the right of the point.

    Segment tree link

    Similar to a range tree where leaves are elementary intervals in a possibly continuous space rather than discrete and higher nodes are unions of the elementary intervals. Used to check for point inclusion.

提交回复
热议问题