Skip to content

Segment Tree

Andrew Shepherd edited this page Nov 17, 2024 · 3 revisions

A Segment Tree is a data structure that stores information about array intervals as a tree. This allows answering range queries over an array efficiently, while still being flexible enough to allow quick modification of the array. This includes finding the sum of consecutive array elements.

I find that while they are easy to understand, they are really difficult to code up quickly.

Problems

Clone this wiki locally