@clarketm/superpriorityqueue

PriorityQueue with superpowers! 💪

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
@clarketm/superpriorityqueue
Minified + gzip package size for @clarketm/superpriorityqueue in KB

Readme

PriorityQueue

NPM release

PriorityQueue with superpowers! 💪

Individual Module Installation

Yarn

$ yarn add @clarketm/superpriorityqueue

Npm

$ npm install @clarketm/superpriorityqueue --save

API

constructor(iterable: PriorityQueueIterable, comparator: Comparator)

Construct a PriorityQueue

size: number

Get the current size of the queue

max(): Item

Get the item with the highest priority

high(): Item

Alias to max

Get the item with the highest priority

min(): Item

Get the item with the lowest priority

low(): Item

Alias to min

Get the item with the lowest priority

isEmpty(): boolean

Check if queue is empty

clear(): void

Clear the items from the queue

insert(value: Item, priority: number): number

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)

deleteMax(): Item

Remove and return the item with the highest priority

deleteHigh(): Item

Alias to deleteMax()

Remove and return the item with the highest priority

deleteMin(): Item

Remove and return the item with the lowest priority

deleteLow(): Item

Alias to deleteMin()

Remove and return the item with the lowest priority

toArray(): Array

Convert the queue to an array

QueueNode

QueueNode

constructor(value: Item, priority: number)

Construct a PriorityQueue

value: Item

Get the value of the node

priority: number

Get the priority of the node

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.