Closed galmok closed 6 years ago
Hi Heap based queries a structured in a special way to provide with O(1) either the minimum or the maximum element, but not both. If you need both, you should be looking into TreeSet or something similar. This package doesn't have such implementations.
I am not sure about the internal ordering of the items, but is it possible to cheaply get both the min and max item at the same time? I am currently using two queues, and suffer due to having to synchronize both queues. Would be so much simpler if one queue could provide both min and max at the same time. :)