and the second with printing of stock detailsthen obviously the online booking is more important and must be executed first implementation of priority queue there are two ways to implement priority queue we can either use sorted list to store the elements so that when an element has to be taken outthe queue will not have to be searched for the element with the highest priority or we can use an unsorted list so that insertions are always done at the end of the list every time when an element has to be removed from the listthe element with the highest priority will be searched and removed while sorted list takes (ntime to insert an element in the listit takes only ( time to delete an element on the contraryan unsorted list will take ( time to insert an element and (ntime to delete an element from the list practicallyboth these techniques are inefficient and usually blend of these two approaches is adopted that takes roughly (log ntime or less linked representation of priority queue in the computer memorya priority queue can be represented using arrays or linked lists when priority queue is implemented using linked listthen every node of the list will have three parts(athe information or data part(bthe priority number of the elementand (cthe address of the next element if we are using sorted linked listthen the element with the higher priority will precede the element with the lower priority consider the priority queue shown in fig figure priority queue lower priority number means higher priority for exampleif there are two elements and bwhere has priority number and has priority number then will be processed before as it has higher priority than the priority queue in fig is sorted priority queue having six elements from the queuewe cannot make out whether was inserted before or whether joined the queue before because the list is not sorted based on fcfs herethe element with higher priority comes before the element with lower priority howeverwe can definitely say that was inserted in the queue before because when two elements have the same priority the elements are arranged and processed on fcfs principle insertion when new element has to be inserted in priority queuewe have to traverse the entire list until we find node that has priority lower than that of the new element the new node is inserted before the node with the lower priority howeverif there exists an element that has the same priority as the new elementthe new element is inserted after that element for exampleconsider the priority queue shown in fig figure priority queue if we have to insert new element with data and priority number then the element will be inserted before that has priority number which is lower priority than that of the new element sothe priority queue now becomes as shown in fig figure priority queue after insertion of new node