How to implement segment trees with lazy propagation?

后端 未结 5 1333
刺人心
刺人心 2021-01-30 05:25

I have searched on internet about implementation of Segment trees but found nothing when it came to lazy propagation. There were some previous questions on stack overflow but th

5条回答
  •  臣服心动
    2021-01-30 06:22

    Here's the link. It has an implementation and explanation of segment tree with lazy propagation. Although the code is in Java but it won't matter because there are only two functions 'update' and 'query' and both of them are array based. So these functions would work in C and C++ also without any modification.

    http://isharemylearning.blogspot.in/2012/08/lazy-propagation-in-segment-tree.html

提交回复
热议问题