Object-Oriented Programming · Point72 · Medium
Design a data structure that maintains the median of a numerical stream while accounting for limited memory. It must provide these operations: add_number(num): Insert num into the data structure. find_median(): Return the median of every number received so far. Because the stream may contain a very large amount of data, choose an approach that allows the median to be obtained accurately at any point without ignoring the memory limitation. Input and Output Example Input:…
Checking your access…