I need segment tree for solving of my task. Should I develop my own segment tree, or there is any good implementation of such tree?
I need the following operations:
- Segment update:
tree.add(from, to, value)
- Segment sum:
tree.sum(from, to)
I need segment tree for solving of my task. Should I develop my own segment tree, or there is any good implementation of such tree?
I need the following operations:
tree.add(from, to, value)
tree.sum(from, to)
Copyright © 2021 Jogjafile Inc.
I'm the author of pypi.python.org/pypi/segmenttree. I recommend you to use it because I have fixed mistakes. (Actually they are just bad examples ;-)
It supports
sum
as one of it's features, which I think is what you right need.If you find any mistakes or you have any suggestions, just drop me a message or just submit a pull request on github.