Segment Tree / Binary Indexed Tree

Posted hankunyan

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Segment Tree / Binary Indexed Tree相关的知识,希望对你有一定的参考价值。

参见 307. Range Sum Query - Mutable

Segment Tree

Tree Implementation (SegmentTreeNode)

https://www.youtube.com/watch?v=rYBtViWXYeI&list=PLLuMmzMTgVK7ug02DDoQsf50OtwVDL1xd&index=1
https://leetcode.com/problems/range-sum-query-mutable/discuss/75711/C++-Segment-Treeupdate-and-sum-are-both-O(logn)

 

 

Array Implementation

Since a Segment Tree is a binary tree, a simple linear array can be used to represent the Segment Tree.
https://leetcode.com/articles/a-recursive-approach-to-segment-trees-range-sum-queries-lazy-propagation/
https://www.hackerearth.com/zh/practice/data-structures/advanced-data-structures/segment-trees/tutorial/

 

以上是关于Segment Tree / Binary Indexed Tree的主要内容,如果未能解决你的问题,请参考以下文章

线段树(Segment Tree)

Lintcode: Segment Tree Build

Lintcode: Segment Tree Modify

Lintcode: Segment Tree Query

java Segment Tree.java

lintcode-medium-Segment Tree Query