Tagged articles

recursive construction

1 articles · Page 1 of 1
YiSu Grain
YiSu Grain
Oct 22, 2024 · Fundamentals

How Segment Trees Enable Lightning‑Fast Range Sum Queries

This article explains the segment tree data structure, showing how to build it both bottom‑up and recursively, how node indexing works, and how the query algorithm skips irrelevant intervals to compute range sums in logarithmic time, complete with Python code examples and performance tips.

Pythonbinary treebottom‑up construction
0 likes · 18 min read
How Segment Trees Enable Lightning‑Fast Range Sum Queries