+ 1
How priority queue works
Priority queue works based on priority. And this priority has nothing to do with user, it is set internally by JVM.
5 Antworten
+ 6
meghanamadhub 1003
Hope this article will help you
https://medium.com/omarelgabrys-blog/priority-queues-11e469cda253
+ 5
A PriorityQueue is used when the objects are supposed to be processed based on the priority. It is known that a queue follows First-In-First-Out algorithm, but sometimes the elements of the queue are needed to be processed according to the priority, that’s when the PriorityQueue comes into play. The PriorityQueue is based on the priority heap. The elements of the priority queue are ordered according to the natural ordering, or by a Comparator provided at queue construction time, depending on which constructor is used.
this will help u to understood the concepts of priority queue
https://www.google.com/amp/s/www.geeksforgeeks.org/priority-queue-class-in-java-2/amp/
+ 3
A priority queue is an abstract data type similar to regular queue or stack data structure in which each element additionally has a "priority" associated with it. In a priority queue, an element with high priority is served before an element with low priority. In some implementations, if two elements have the same priority, they are served according to the order in which they were enqueued, while in other implementations, ordering of elements with the same priority is undefined.
- 1
Do any anyone know more about this. If yes plz share