Answer to Question #159209 in Algorithms for Hasan Khan

Question #159209

What is a Priority Queue? How is it Different from an ordinary Queue? Is Heap a Priority Queue? Explain your answers in own words.



1
Expert's answer
2021-01-28T12:00:14-0500

Priority Queue: It is a special kind of queue in which each elements are associated with the priority and it is also served as per it's priority.

Priority queue is different ordinary queue because it do not have any end, in ordinary queue , elements are inserted from one end and remove from the other ends but in the priority queue insertion of elements can be in any order but the removal of the elements can be done in sorted order.

So we can conclude that sorting will be done when elements are removed from the priority queue. the priority queue can be easily implemented by a heap.

Heap is a kind of maximally efficient implementation of abstract data type which is also called the priority queue. Generally we say that priority queue is a kind of heap.


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS