Relative Content

Tag Archive for pythonsegment-tree

Why does my segment tree give incorrect answers?

I’m learning the segment tree data structure but I cannot for the life of me figure out what’s wrong with my implementation. I’m using a 1-indexed tree, so nothing is stored at tree[0].