Questions tagged [priority-queue]
Priority queues are dynamic sets that always remove highest priority elements first.
72 questions
4votes
0answers
60views
Implementation of Indexed Priority Queue
I'm learning Graph Theory and trying to solve the Dijkstra Problem. One of the best ways to solve the problem is to use Indexed Priority Queue and so, I implemented it. The code is below. Pls review ...
2votes
1answer
122views
C++ implementation of a keyed priority queue / binary heap
I wrote an implementation of a keyed priority queue in C++ and wanted to get some feedback on it. I tried to model it after the std::unordered_map and ...
5votes
0answers
105views
Dial's heap in Java for integer priority queues
(The entire project is here.) Intro I have this priority queue data structure for non-negative integer priority keys. I recall that it is called Dial's heap. Code Implementation ...
3votes
1answer
144views
Binary heap based priority queue implementation in C#
I made this Priority Queue implementation for C# since it doesn't support updating priorities in logarithmic time complexity. I did some tests and it seems that it's correct. However, I'm not sure ...
7votes
2answers
404views
Priority Queue (With raise priority operation) using Vector
Here I have implemented a priority queue, with the addition of the raise_priority (also known as reduce key) operation. The reason I have effectively reimplemented std::priority_queue is because the ...
5votes
1answer
95views
Bidirectional Dijkstra d-ary heap
This is my very first data structure written in Perl for a d-ary heap: ...
2votes
1answer
110views
Priority Queue for D* Lite
So, I needed a priority queue for D* lite and I wanted to know whether this is an acceptable implementation or not. ...
6votes
2answers
4kviews
C++ Thread safe priority queue implementation
My first attempt at writing a thread safe priority_queue. It is not the most efficient because the locks can be even more fine grained if I add implementation of heap instead of using priority_queue ...
2votes
0answers
304views
Kotlin AsyncPriorityQueue
Unbounded threadsafe suspending priority queue Items are ordered by an integer priority value passed into the enqueue() method dequeue() retrieves and removes the head of the queue or suspends until ...
2votes
1answer
263views
Minimum Spanning Tree in Rust
As a project I have worked on implementing and benchmarking two different minimum spanning tree algorithms in rust. My main concern is adhering to good style and not programming any glaring ...
1vote
1answer
74views
Assigning Tasks to Entities (or some other entity) based on Priority
Main Questions: Is my runtime analysis correct? Is my approach optimal or close to it? Is there a better way and/or improvements? Objective: Write an algorithm to assign ...
2votes
1answer
934views
Generic PriorityQueue (Min-Heap) implementation
I was trying to implement a generic PriorityQueue in C#. Below is my implementation which works fine as per few test cases. Operations supported- Add: Adds an element Poll: Removes the smallest ...
8votes
2answers
530views
Planned Economy Bakery - Trying to scale a nested loop with a heap
Let's say you are living in a controlled economy where there is a baker in town, and every day he bakes a random number of loaves of bread (sometimes the oven breaks, or he has less ingredients). The ...
2votes
2answers
534views
Priority queue implementation on C. (For Huffman Coding)
I trying to implement Huffman Codes on C. And, since my previous attempt failed, I decided to approach the issue more responsibly. So I'm asking for feedback on my implementation of the priority queue ...
4votes
2answers
195views
JavaScript Priority Queue implementation using a binary heap
I'm currently going over Robert Sedgewick's Algorithms book. For the implementation of A priority queue using a binary heap I implemented the code using ES6. I believe to have more experience with ...