Top "Priority-queue" questions

A priority queue is a regular queue or stack data structure, but where additionally each element has a "priority" associated with it.

How do I use a PriorityQueue?

How do I get a PriorityQueue to sort on what I want it to sort on? Also, is there a …

java priority-queue
Change priorityQueue to max priorityqueue

I have priority queue in Java of Integers: PriorityQueue<Integer> pq= new PriorityQueue<Integer>(); When I …

java collections priority-queue
Priority queue in .Net

I am looking for a .NET implementation of a priority queue or heap data structure Priority queues are data structures …

c# .net data-structures heap priority-queue
declaring a priority_queue in c++ with a custom comparator

I'm trying to declare a priority_queue of nodes, using bool Compare(Node a, Node b) as the comparator function (…

c++ std priority-queue
How can I create Min stl priority_queue?

The default stl priority queue is a Max one (Top function returns the largest element). Say, for simplicity, that it …

c++ stl priority-queue
How does Java's PriorityQueue differ from a min-heap?

Why did they name PriorityQueue if you can't insertWithPriority? It seems very similar to a heap. Are there any differences? …

java priority-queue
Updating Java PriorityQueue when its elements change priority

I'm trying to use a PriorityQueue to order objects using a Comparator. This can be achieved easily, but the objects …

java priority-queue
Implementing Java Comparator

I am trying to write an algorithm which utilizes a min-priority queue, so I looked around on google and found …

java implementation priority-queue comparator
How to iterate over a PriorityQueue?

for (Event e : pq) doesn't iterate in the priority order. while(!pq.isEmpty()){ Event e = pq.poll(); } This works but …

java collections loops priority-queue
Can I get an item from a PriorityQueue without removing it yet?

I want to get the next item in queue but I don't want to dequeue it. Is it possible in …

python python-3.x queue priority-queue peek