0

There is list like a = [1,3,2,4] and I want to find median of [1], [1,3], [1,3,2], [1,3,2,4] (a[0:k],0<=k<=n)

I know that if I use MaxHeap and minHeap I can solve this in nlogn but I want to know Is there any way using only Max or Min heap to solve this in nlogn colplexity

Gosla
  • 1
  • Does this help you? https://stackoverflow.com/questions/38806202/whats-the-time-complexity-of-functions-in-heapq-library/38833175#:~:text=The%20complexity%20is%20O(n,O(n%20log%20n).&text=heapify()%20actually%20takes%20linear,is%20different%20than%20calling%20heapq. – Aru May 30 '21 at 17:34
  • Thank you for you answer but there comments are using Min and Max heap. I want to know way that only using Max or Min heap. – Gosla May 31 '21 at 06:13

0 Answers0