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:

https://codeforces.com/blog/entry/18051

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