Iterative segment tree template

Can anybody give some fast iterative segment tree or some other data structure template in python for supporting range queries and range updates simultaneously which works relatively faster than other ds like recursive segment tree

@meooow @mathecodician

Usually I use this one:

It is in C++ but you can easily convert it to Python.

2 Likes

iterative segment tree it’s in java and same as the above CF link.(range , build and update queries). [Lazy Propagation is not implemented].

you can test this one written in python… python segment tree
[haven’t tested]

oh @deido i also use this segment tree :slight_smile:

1 Like

i want to add lazy prop. & range update function in this code but unable to do it. If you have the code can you give it to me?