Questions tagged [priority-queue]
Priority queues are dynamic sets that always remove highest priority elements first.
                72 questions
            
            
            
                3
            
            votes
        
        
            
                0
            
            answers
        
        
            
                67
            
            views
        
        
            
            
        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 ...
                
            
       
        
            
                3
            
            votes
        
        
            
                1
            
            answer
        
        
            
                142
            
            views
        
        
            
            
            
        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 ...
                
            
       
        
            
                5
            
            votes
        
        
            
                0
            
            answers
        
        
            
                114
            
            views
        
        
            
        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
...
                
            
       
        
            
                3
            
            votes
        
        
            
                1
            
            answer
        
        
            
                165
            
            views
        
        
            
            
            
        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 ...
                
            
       
        
            
                7
            
            votes
        
        
            
                2
            
            answers
        
        
            
                449
            
            views
        
        
            
            
            
        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 ...
                
            
       
        
            
                5
            
            votes
        
        
            
                1
            
            answer
        
        
            
                107
            
            views
        
        
            
            
        Bidirectional Dijkstra d-ary heap
                    This is my very first data structure written in Perl for a d-ary heap:
...
                
            
       
        
            
                2
            
            votes
        
        
            
                1
            
            answer
        
        
            
                125
            
            views
        
        
            
        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.
...
                
            
       
        
            
                6
            
            votes
        
        
            
                2
            
            answers
        
        
            
                4k
            
            views
        
        
            
        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 ...
                
            
       
        
            
                2
            
            votes
        
        
            
                0
            
            answers
        
        
            
                313
            
            views
        
        
        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 ...
                
            
       
        
            
                2
            
            votes
        
        
            
                1
            
            answer
        
        
            
                275
            
            views
        
        
            
            
        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 ...
                
            
       
        
            
                1
            
            vote
        
        
            
                1
            
            answer
        
        
            
                93
            
            views
        
        
            
        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 ...
                
            
       
        
            
                2
            
            votes
        
        
            
                1
            
            answer
        
        
            
                958
            
            views
        
        
            
            
            
        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 ...
                
            
       
        
            
                8
            
            votes
        
        
            
                2
            
            answers
        
        
            
                585
            
            views
        
        
            
            
            
        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 ...
                
            
       
        
            
                2
            
            votes
        
        
            
                2
            
            answers
        
        
            
                551
            
            views
        
        
            
            
        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 ...
                
            
       
        
            
                4
            
            votes
        
        
            
                2
            
            answers
        
        
            
                217
            
            views
        
        
            
            
            
        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 ...
                
            
       
         
         
         
        