Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add range variants of FindMin() and DeleteMin() #94

Open
vslee opened this issue Jun 10, 2020 · 0 comments
Open

Add range variants of FindMin() and DeleteMin() #94

vslee opened this issue Jun 10, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@vslee
Copy link

vslee commented Jun 10, 2020

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. 

@vslee vslee added the enhancement New feature or request label Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant