sphinxy / DataStructures

Concurrent priority queue and skip list for .NET
MIT License
42 stars 23 forks source link

Getting both min and max? #10

Closed galmok closed 6 years ago

galmok commented 6 years ago

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. :)

dshulepov commented 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.