1.2.32 • Published 7 years ago

@clarketm/superpriorityqueue v1.2.32

Weekly downloads
2
License
MIT
Repository
-
Last release
7 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

7 years ago

1.2.31

7 years ago

1.2.25

7 years ago

1.2.20

7 years ago

1.2.18

7 years ago

1.2.17

7 years ago

1.2.16

7 years ago

1.2.15

7 years ago

1.2.14

7 years ago

1.2.13

7 years ago

1.2.11

7 years ago

1.2.10

7 years ago

1.2.7

7 years ago