Segment trees and Fenwick trees
Structures that answer questions like “what do items 300 to 900 add up to?” quickly, even while the data keeps changing.
A answers range questions instantly but has to be rebuilt whenever a value changes. These structures accept slightly slower queries in exchange for cheap updates, which is the right trade when data is live.
A Fenwick tree is remarkably compact — about ten lines — but the index arithmetic is genuinely unintuitive. A segment tree is longer and much easier to reason about.
Rarely needed outside competitive programming. Worth knowing the name and the shape of the problem they solve, so you recognise it if it ever turns up.
What it costsBoth give range queries and O(log n) updates.
Where you meet it in real softwareLive analytics dashboards, leaderboards, range totals over data that keeps changing.