cheran-senthil / PyRival

⚡ Competitive Programming Library
https://pyrival.readthedocs.io/
Apache License 2.0
1.17k stars 312 forks source link

SegmentTree segment update #72

Closed kaiyuhou closed 2 years ago

kaiyuhou commented 2 years ago

Is your feature request related to a problem? Please describe. No.

Describe the solution you'd like I have no clear idea.

Describe alternatives you've considered Using binary index tree instead.

Additional context For current SegmentTree implementation, it only supports update for one item at once. Is that possible to update a segment at once? Thank you.

https://github.com/cheran-senthil/PyRival/blob/master/pyrival/data_structures/SegmentTree.py

bjorn-martinsson commented 2 years ago

The data structure you are looking for is called a lazy segment tree. https://github.com/cheran-senthil/PyRival/blob/master/pyrival/data_structures/LazySegmentTree.py

kaiyuhou commented 2 years ago

Thank you. I solved my question.