Computer Science, asked by nadiamasood55, 5 months ago

: Implement a Priority Queue of names such that alphabetically smaller names are always the first ones to be dequeued. Take five to ten random names from the user and insert them in queue in order. Then call the dequeue function multiple times to obtain alphabetically smaller names from queue and print them.

Answers

Answered by aneesh1983
1

Answer:

Priority Queue

In this tutorial, you will learn what priority queue is. Also, you will learn about it's implementations in Python, Java, C, and C++.

A priority queue is a special type of queue in which each element is associated with a priority and is served according to its priority. If elements with the same priority occur, they are served according to their order in the queue.

Generally, the value of the element itself is considered for assigning the priority.

For example, The element with the highest value is considered as the highest priority element. However, in other cases, we can assume the element with the lowest value as the highest priority element. In other cases, we can set priorities according to our needs.

Similar questions