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

Homebrew priority queue -> std::set? #9

Open
Komzpa opened this issue Oct 5, 2019 · 0 comments
Open

Homebrew priority queue -> std::set? #9

Komzpa opened this issue Oct 5, 2019 · 0 comments

Comments

@Komzpa
Copy link

Komzpa commented Oct 5, 2019

I see that std::priority_queue doesn't have the required Remove method. Googling the stackoverflow to learn how people live with that in C++ land got this: people sometimes use std::set for that, if queue can't keep element multiple times. It has erase method to remove something. Underlying structure is then a binary tree instead of heap, allowing faster removal without repacking everything.

Hope this helps, feel free to ignore, any comment why is it bad idea if it is would be appreciated.

// priority queue functions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant