Priority queues are dynamic sets that always remove highest priority elements first.

learn more… | top users | synonyms

3
votes
1answer
60 views

Python priority queue class wrapper

I'm trying to incorporate the advice found in https://docs.python.org/3.5/library/heapq.html in order to make a priority queue implementation (see corresponding section) in a class ...
2
votes
1answer
89 views

Priority queue implementation using unsorted and sorted array

Below is the unsorted array and sorted array implementation of priority queue. Code directory structure: ...
5
votes
1answer
92 views

C++ Heap implementation

I'm on my way of understanding basic data structures and sorting algorithms through implementing them in c++. Post is followed of my implementation of Vector. I decided to weld the heap behaviour ...
0
votes
1answer
151 views

Node comparison using priority queue for Dijkstra's Shortest Path Algorithm

Instead of using a MinHeap that will allow me to change the vertex priorities I am using the Java library PriorityQueue. Here ...
1
vote
1answer
71 views

Dijkstra's Algorithm not optimized enough

I was attempting a question on HackerRank-Dijkstra's Shortest Reach 2 and upon submission my programs times out in 3/7 test cases. One of the test cases had 200 nodes and about 2000 connections. Here ...
0
votes
0answers
52 views

Priority Queue/BinaryHeap Implementation in Objective-C

I don't see a ready-made priority queue class in Objective-C. Please review this. Full xcodeproject with unit test cases at https://github.com/smartiothome/BinaryHeap Heap.h ...
5
votes
1answer
189 views

Indexed Fibonacci heap implementation

I implemented two versions of a Fibonacci heap one using a unordered map (mapping keys to their nodes) so that the client can call decrease in \$O(1)\$ average and ...
1
vote
1answer
278 views

Implement a generic Priority Queue in C++

I wrote a Priority Queue that is stored using a doubly linked list. The queue can return the head and tail of the list, and contains a print function that is only used for testing purposes. I'd like ...
4
votes
3answers
69 views

C Threadsafe Priority Queue O(log n) push, O(1) pop

I wrote this for an A* implementation: (pqueue.c) ...
1
vote
0answers
40 views

Glueing Java collections into a heap

I have implemented this heap (priority queue) data structure using java.util.TreeMap and java.util.ArrayDeque. The operations ...
10
votes
1answer
74 views

Longest lines using priority queue

Inspired by a comment on this question, I thought I'd exercise my C skills by implementing something like it using a priority queue. The idea is to be able to invoke the program like this: ./...
4
votes
4answers
152 views

Subdividing intervals that contain the largest error values

I'm trying to accomplish the following: Start out with 1 interval on the real line. This interval is processed in some function and out comes an array of errors (size < 10 usually). The maximum ...
3
votes
2answers
49 views

Time Limit Exceeded for build_max_heap

This problem is from HackerEarth: The Monk learned about priority queues recently and asked his teacher for an interesting problem. So his teacher came up with a simple problem. He now has an ...
1
vote
3answers
551 views

Priority Queue (Binary Search Tree) Implementation

I have made a Priority Queue implemented as a Binary Search Tree. I would appreciate comments related to optimization and proper functionality, but any comments/critiques are welcome. PQ.h: ...
1
vote
0answers
50 views

Generic implementation of mutable binary heap

std::priority_queue does not support dynamically updating element priorities. This class template extends it by allowing updating priorities of elements in the heap....
1
vote
2answers
129 views

Fibonacci heap in C - follow-up

(See the previous iteration.) I have incorporated some points made by ChrisWue and refactored my Fibonacci heap implementation: fibonacci_heap.h ...
3
votes
1answer
562 views

Fibonacci heap in C

(See the next iteration.) I have rewritten a Fibonacci heap implementation from Java to C. fibonacci_heap.h: ...
10
votes
2answers
161 views

SortedStack implementation in Java

This is a data structure that supports the push(), pop() and isEmpty() operations and ...
3
votes
0answers
74 views

Updatable priority queue

This is an updatable priority queue. In contains an index (implemented as std::unordered_map) which maps a value to its position in the queue itself. The queue is ...
3
votes
0answers
93 views

Min-Heap based priority queue class written in ES6

I would appreciate any feedback on syntax, naming convention, possible shortcuts, clarity of code and any other constructive feedback. This code was based off of the Priority Queue chapter in The ...
5
votes
1answer
103 views

Comparing puzzle solvers in Java

I have this program that solves a \$(n^2 - 1)\$-puzzles for general \$n\$. I have three solvers: BidirectionalBFSPathFinder ...
3
votes
1answer
73 views

d-ary heap in C

Now I have this d-ary heap data structure. Note that for d = 2 this is a binary heap. The client programmer specifies the value ...
4
votes
2answers
380 views

ObservablePriorityQueue<T> Implementation

I have a requirement in my current project that will need a Prioritised Queue that supports the IObservable interface. Please notify me of any problems with the implementation that I currently have: ...
5
votes
1answer
4k views

Javascript PriorityQueue based on object property

I wrote this class which is a priority queue based on a numeric property of any object. As far as I can tell, the following code is working as intended. Are there any stylistic tendencies that I am ...
6
votes
2answers
954 views

My implementation of FixedSizedPriorityQueue

I implemented a fixed sized priority queue. How can I improve my code? ...
3
votes
4answers
5k views

Priority queue implementation in C#

My application has a thread for handling database inserts and updates. Data is added by other threads to a generic queue in the DB thread. The contents of this queue is retrieved and is sequentially ...