• Post Reply Bookmark Topic Watch Topic
  • New Topic

PriorityQueue  RSS feed

 
Sreedevi Vinod
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The API says "The PriorityQueue gives an unbounded priority queue based on a priority heap". What is actually a priority heap ? And in what kind of design do we go for a PriorityQueue implementation ? Any information would be welcome.

Thanks
Devi
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Priority Heap" is a term I have not heard of before. However Priority Queues can be implemented with heaps: Here is an article describing such an implementation.

As for examples their use: Any queue where some customers should be served before other customers. Shops may serve some (richer/good credit) customers before others. A hospital out-patients queue would take emergency cases before waiting non-emegencies. An operating system queues processes to be executed according to priority. Java threads are scheduled according to priority within the JVM.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's move over to Java In General (Intermediate). There's some clever guys there.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!