@clarketm/superpriorityqueue

1.2.32 • Public • Published

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

Package Sidebar

Install

npm i @clarketm/superpriorityqueue

Weekly Downloads

1

Version

1.2.32

License

MIT

Unpacked Size

27.4 kB

Total Files

7

Last publish

Collaborators

  • clarketm