1.0.13 • Published 3 years ago
priority-queue-v2 v1.0.13
priority-queue-v2
Published at - https://www.npmjs.com/package/priority-queue-v2
queue - add an element to the queue dequeue - delete the max priority element from the queue isEmpty - returns true/false clear - clear the queue delete - If we need to update the priority, delete that item and insert it in again list - contents of heap
The Item stored in the queue should be class and a comparator should be provided. By default, duplicate elements are not allowed. To allow duplicates in the queue add the allowDuplicates argument to true. let obj = new PriorityQueue(comparator, true)
let comparator = function (a, b) { return a >= b ? false : true }