0 votes
in DBMS by

What is a priority queue? What are the applications for priority queue?

1 Answer

0 votes
by
edited by

Priority Queue is an abstract data type that is similar to a queue in that each element is assigned a priority value. The order in which elements in a priority queue are served is determined by their priority (i.e., the order in which they are removed). If the elements have the same priority, they are served in the order they appear in the queue.

Following are some real-time applications for priority queue:

  • Used in graph algorithms like Dijkstra, Prim’s Minimum spanning tree etc.
  • Huffman code for data compression
  • Finding Kth Largest/Smallest element

Related questions

0 votes
asked Aug 10, 2023 in DBMS by DavidAnderson
0 votes
asked Aug 10, 2023 in DBMS by DavidAnderson
...