PriorityQueue with superpowers! 💪
$ yarn add @clarketm/superpriorityqueue
$ npm install @clarketm/superpriorityqueue --save
Construct a PriorityQueue
Get the current size of the queue
Get the item with the highest priority
Alias to
max
Get the item with the highest priority
Get the item with the lowest priority
Alias to
min
Get the item with the lowest priority
Check if queue is empty
Clear the items from the queue
Enqueue an item into the queue
Name | Type | Attribute | Description |
---|---|---|---|
value | Item | item to insert | |
priority | number | optional: true, default: 0 | priority of item (higher value === higher priority) |
Remove and return the item with the highest priority
Alias to
deleteMax()
Remove and return the item with the highest priority
Remove and return the item with the lowest priority
Alias to
deleteMin()
Remove and return the item with the lowest priority
Convert the queue to an array
QueueNode
Construct a PriorityQueue
Get the value of the node
Get the priority of the node