Skip to content

An array and heap based implementation of Priority Queue

Notifications You must be signed in to change notification settings

AjayPoshak/PriorityQueue

Repository files navigation

PriorityQueue

Build Status

Array based Priority Queue implemented in JS.

Highest Priority - 1, Lowest Priority - 10

Usage

const PriorityQueue = require( './PriorityQueue')

const pQueue = new PriorityQueue()

// Add elements to queue
pQueue.queue(21, 6) // elements = 21 and priority is 6
pQueue.queue(22) // default priority = 5
pQueue.queue(29, 7)
pQueue.queue(11, 9) // default priority = 5

// Remove elements from queue
pQueue.dequeue() // Output => 21 [element with highest priority]

About

An array and heap based implementation of Priority Queue

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published