About this question

Two-Level Price Map Order Book Range Query

Hard · data_structures · Quant Developer interview question · order-book, two-level-map, range-query, data_structures, std-map, price-levels, vwap

High-frequency trading systems often use a two-level map to represent an order book, enabling efficient data access. This structure partitions price levels into coarse buckets, which is critical for performing fast range queries. Such queries are fundamental for algorithms like VWAP calculation and iceberg order detection. Task Implement two functions, insert_price_level and range_query, to manage a two-level order book map. The insert_price_level(TwoLevelMap& tlm, int price, int volume) functi