About this question
Medium · Number Theory & Algorithms · Quant Trader interview question · data-structures, algorithms, time-complexity, min-heap
You are building a real-time market surveillance system that needs to identify the top k most actively traded stocks based on the number of trades executed. You receive a continuous stream of trade data, and for each trade, you need to update your list of top k stocks efficiently. You decide to use a min-heap data structure to maintain the top k stocks and their trade counts. Assume you have already implemented the min-heap. What is the overall time complexity of processing N trades to find th