🏗️ Segment Tree — Build
USACO C++ Book · Interactive Visualizer
🌲 Segment Tree Build
Array [1,3,5,7,9,11]
O(N)
Step 0/12
📊 Graph
[0..5]
?
[0..2]
?
[3..5]
?
[0..1]
?
[2..2]
?
[3..4]
?
[5..5]
?
[0]
?
[1]
?
[3]
?
[4]
?
Original: [1, 3, 5, 7, 9, 11]
🗂 tree[] Array
tree[i] = sum of the node's interval
💻 Code
Click Next Step to start
◀ Prev
Next Step ▶
↺ Reset
0/12
Keyboard:
→
Next
←
Prev
R
Reset