priority queues (heapsalthough jobs sent to printer are generally placed on queuethis might not always be the best thing to do for instanceone job might be particularly importantso it might be desirable to allow that job to be run as soon as the printer is available converselyifwhen the printer becomes availablethere are several -page jobs and one -page jobit might be reasonable to make the long job go lasteven if it is not the last job submitted (unfortunatelymost systems do not do thiswhich can be particularly annoying at times similarlyin multiuser environmentthe operating system scheduler must decide which of several processes to run generallya process is allowed to run only for fixed period of time one algorithm uses queue jobs are initially placed at the end of the queue the scheduler will repeatedly take the first job on the queuerun it until either it finishes or its time limit is upand place it at the end of the queue if it does not finish this strategy is generally not appropriatebecause very short jobs will seem to take long time because of the wait involved to run generallyit is important that short jobs finish as fast as possibleso these jobs should have precedence over jobs that have already been running furthermoresome jobs that are not short are still very important and should also have precedence this particular application seems to require special kind of queueknown as priority queue in this we will discuss efficient implementation of the priority queue adt uses of priority queues advanced implementations of priority queues the data structures we will see are among the most elegant in computer science model priority queue is data structure that allows at least the following two operationsinsertwhich does the obvious thingand deleteminwhich findsreturnsand removes the minimum element in the priority queue the insert operation is the equivalent of enqueueand deletemin is the priority queue equivalent of the queue' dequeue operation the +code provides two versions of deletemin one removes the minimumthe other removes the minimum and stores the removed value in an object passed by reference