queues implementationunbounded priority queue there are number of ways to implement an unbounded priority queue adt the most basic is to use python list or linked list as was done with the queue adt to implement the priority queuewe must consider several facts related to the definition of the adta priority must be associated with each item in the queuepossibly requiring the value to be stored along with the item the next item to be dequeued from the priority queue is the item with the highest priority if multiple items have the same prioritythose items must be dequeued in the order they were originally enqueued python list implementation we used python list to implement the basic queue earlier in the in that implementationthe queue items were organized within the list from front to back with new items appended directly to the end and existing items removed from the front that simple organization worked well with the basic queue when implementing the priority queuehoweverthe items cannot simply be added directly to the listbut instead we must have way to associate priority with each item this can be accomplished with simple storage class containing two fieldsone for the priority and one for the queue item for exampleclass _priorityqentry def __init__selfitempriority )self item item self priority priority with the use of storage class for maintaining the associated prioritiesthe next question is how should the entries be organized within the vectorwe can consider two approachesboth of which satisfy the requirements of the priority queueappend new items to the end of the list when new item is enqueuedsimply append new instance of the storage class (containing the item and its priorityto the end of the list when an item is dequeuedsearch the vector for the item with the lowest priority and remove it from the list if more than one item has the same prioritythe first one encountered during the search will be the first to be dequeued keep the items sorted within the list based on their priority when new item is enqueuedfind its proper position within the list based on its priority and insert an instance of the storage class at that point if we order the items in the vector from lowest priority at the front to highest at the endthen the dequeue operation simply requires the removal of the last item in the list to maintain