About this question

Segment Tree Range Query Time Complexity

Hard · Algorithms & Data Structures · Quant Trader interview question · segment-tree, range-query, time-complexity, algorithms

You are implementing a real-time market data feed aggregator. To efficiently process incoming price updates for a large number of assets, you decide to use a segment tree to store and query price data. You need to frequently calculate the sum of prices for a given range of assets. What is the time complexity of performing a range sum query on a segment tree with $n$ elements, assuming the segment tree has already been constructed?