as with the python list implementation of the priority queuetesting for an empty queue and determining the size can be done in ( time the enqueue operation can also be done in constant time since we need only append new node to the end of the list the dequeue operationhoweverrequires (ntime since the entire list must be searched in the worst case to find the entry with the highest priority once that entry is locatedthe node can be removed from the list in constant time implementationbounded priority queue the python list and linked list versions are quite simple to implement and can be used to implement the bounded priority queue but they both require linear time to dequeue an item since the priorities of bounded priority queue are restricted to finite set [ )we can improve this worst case time with an implementation in which all of the operations only require constant time this can be done using an array of queuesas illustrated in figure size qlevels bpriorityqueue "white"black"black"orange"orange"purple"purple"green"greenabstract view of the queues "yellow"yellowfigure implementation of the priority queue using an array of queues the implementation of the bounded priority queue adt is shown in listing the constructor creates two data fields the qlevels field contains an array of elements in which each contains an instance of the queue adt the size field maintains the number of items in the priority queuewhich can also be used to determine if the queue is empty when an item with priority is added to the priority queueit is added to the queue stored in the qlist[kelement to dequeue an item from the priority queuewe must iterate through the array to find the first non-empty queuewhich will contain the first item to be removed from the priority queue note that we do not have to store the priorities along with each item since all items with given priority will be stored in the same queue the priority can be determined from the array indices