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

Heap initialization utility MaxPriorityQueue.from is O(N log N) #66

Open
osuritz opened this issue Apr 21, 2024 · 0 comments · May be fixed by #68
Open

Heap initialization utility MaxPriorityQueue.from is O(N log N) #66

osuritz opened this issue Apr 21, 2024 · 0 comments · May be fixed by #68
Assignees
Labels
enhancement New feature or request

Comments

@osuritz
Copy link

osuritz commented Apr 21, 2024

(Max|Min)PriorityQueue.from static method naively constructs the heap one element at a time which takes O(N log N) time (because each insertion is a log N operation.

There is a better way to set it up when the incoming values are known at heap initialization time that runs in O(N) time.

@eyas-ranjous eyas-ranjous self-assigned this Jul 14, 2024
@eyas-ranjous eyas-ranjous linked a pull request Jul 15, 2024 that will close this issue
@eyas-ranjous eyas-ranjous added the enhancement New feature or request label Jul 15, 2024
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

Successfully merging a pull request may close this issue.

2 participants