1

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.

2
  • 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. Commented Dec 30, 2014 at 20:59
  • 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. Commented Dec 30, 2014 at 21:01

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.