Skip to content

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

@osuritz

Description

@osuritz

(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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions