AI engineering glossary · Data structures algorithms
What is segment tree?
Segment tree: A tree built over an array where each node stores a summary, such as sum or minimum, of a range of positions. It answers range queries and applies point updates in O(log n) time.
Segment tree: an example
For daily sales of a year, a segment tree returns the total for any date range, such as 14 to 200, in about nine node visits, and updates one day quickly.
Related terms
More Data structures algorithms terms
- Selection sort
- Separate chaining
- Shortest path
- Sliding window
- Sorting
- Space complexity
- Space-time trade-off
- Stable sort
Where you learn it
Segment tree is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.