1
votes

I am quite new to javascript and currently I am working on a problem where I need a min priority queue with decrease key and extract min operation. This is just a part of the problem so I was wondering if there is any resource with such library.

Also the link that I am getting after search is on node.js, but I am hesitant to use it since I am pretty new to js and have no knowledge about node.js.

Is it the case that I have to build both the priority queue and binary heap from scratch myself for js?

I would appreciate any help.

EDIT:

decrease key operation is a standard operation that decreases the priority of some existing element of queue. It should be an O(log N) operation with binary heap.

1
What does the decrease key operation do exactly? Anyway, I'm pretty certain you will need to build these data structures from scratch, but please look at github.com/mauriciosantos/buckets library for said data structure. - ThisClark
It's a standard operation in priority queue that decreases the priority of an existing element in queue. This should be in O(log N) with binary heap. - Naman

1 Answers

1
votes

I found out the following resource for exactly what I have been looking for:

https://github.com/rombdn/js-binaryheap-decreasekey

I hope this helps other people.