stacks and queues letter on top is always processed first more urgent letters are inserted higher less urgent letters are inserted lower figure letters in priority queue in many situations you want access to the item with the lowest key value (which might represent the cheapest or shortest way to do somethingthusthe item with the smallest key has the highest priority somewhat arbitrarilywe'll assume that' the case in this discussionalthough there are other situations in which the highest key has the highest priority besides providing quick access to the item with the smallest keyyou also want priority queue to provide fairly quick insertion for this reasonpriority queues areas we noted earlieroften implemented with data structure called heap we'll look at heaps in "heaps in this we'll show priority queue implemented by simple array this implementation suffers from slow insertionbut it' simpler and is appropriate when the number of items isn' high or insertion speed isn' critical the priorityq workshop applet the priorityq workshop applet implements priority queue with an arrayin which the items are kept in sorted order it' an ascending-priority queuein which the item with smallest key has the highest priority and is accessed with remove((if the highest-key item were accessedit would be descending-priority queue