About this question

Fixed-Size Top-N Tracker with Min-Heap

Easy · data_structures · Quant Developer interview question · priority-queue, min-heap, top-n, data_structures, fixed-size, streaming

A fixed-size min-heap is a highly efficient data structure for tracking the top-N largest items from a high-throughput data stream. In quantitative finance, this technique is critical for building real-time risk dashboards and detecting large block trades, providing O(log N) performance per update essential for HFT systems. Task Implement the function top_n_tracker(int n, const std::vector<int>& values) that finds the top n largest integers from an input vector. Using a min-heap of capacity n,