New answers tagged


For time complexity, it partly depends on where you want to improve the time. You could consider a FIFO where each record has the price and the timestamp and also something else: the largest price over every item that is as/more recent. This would mean an $O(n)$ operation for each batch of items that is inserted, but it would improve the time for fetching ...

Top 50 recent answers are included