-
Notifications
You must be signed in to change notification settings - Fork 179
Description
Description
SortedDictionaryBase<K,V> currently has FindMin/Max() and DeleteMin/Max(). These work on single items, but it would be useful to have range variants to efficiently get multiple items at once.
Solution
Add variants, such as FindMinRange(int numItems) and DeleteMinRange(int numItems).
Describe alternatives you've considered
For DeleteMinRange(), one could call DeleteMin() multiple times. But this is likely is not as efficient as a range implementation which can perform the entire operation at once.
For FindMinRange(), calling FindMin() multiple times wouldn't work. One could workaround this by calling RangeAll() and iterating through that. But that seems roundabout and is not immediately obvious.
There are also the RangeFrom(K bot) and RangeTo(K top), but those don't allow specifying numItems as a parameter.
Additional context
Eventually, these variants could be added to PriorityQueue<T> as well. But implementing it in IntervalHeap<T> will take some effort.