1.2.32 • Published 5 years ago

@clarketm/superpriorityqueue v1.2.32

Weekly downloads
2
License
MIT
Repository
-
Last release
5 years ago

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

NameTypeAttributeDescription
valueItemitem to insert
prioritynumberoptional: true, default: 0priority 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

1.2.32

5 years ago

1.2.31

6 years ago

1.2.25

6 years ago

1.2.20

6 years ago

1.2.18

6 years ago

1.2.17

6 years ago

1.2.16

6 years ago

1.2.15

6 years ago

1.2.14

6 years ago

1.2.13

6 years ago

1.2.11

6 years ago

1.2.10

6 years ago

1.2.7

6 years ago