About this question
Medium · data_structures · Quant Developer interview question · order-book, sorted-array, binary-search, best-bid-ask, data_structures, mid-price
A price-level order book is a core data structure in high-frequency trading for tracking buy (bid) and sell (ask) orders. For low-latency applications, a compact sorted-array representation offers cache-efficient O(1) lookups for the best bid and ask. The mid-price, calculated as (best_bid + best_ask) / 2.0, serves as a crucial reference for pricing models and execution strategies. Task Implement the OrderBook class to manage bid and ask price levels using sorted vectors. The implementation mus