half the items in the array must be moved to insert the new one in order in this we'll describe another structure that can be used to implement priority queuethe heap heap is kind of tree it offers both insertion and deletion in (logntime thus it' not quite as fast for deletionbut much faster for insertion it' the method of choice for implementing priority queues where speed is important and there will be many insertions (incidentallydon' confuse the term heapused here for special kind of binary treewith the same term used to mean the portion of computer memory available to programmer with new in languages like java and +the heap workshop applet the heap workshop applet demonstrates the operations we discussed in the last sectionit allows you to insert new items into heap and remove the largest item in addition you can change the priority of given item when you start up the heap workshop appletyou'll see display similar to figure figure the heap workshop applet there are four buttonsfillchngremand insfor fillchangeremoveand insert let' see how they work fill the heap contains nodes when the applet is first started using the fill key you can create new heap with any number of nodes from to press fill repeatedlyand type in the desired number when prompted change it' possible to change the priority of an existing node this is useful procedure in many situations for examplein our cruiser examplea threat such as an approaching airplane may reverse course away from the carrierits priority should be lowered to reflect this new developmentalthough the aircraft would remain in the priority queue until it was out of radar range to change the priority of noderepeatedly press the chng key when promptedclick on the node with the mouse this will position the red arrow on the node thenwhen promptedtype in the node' new priority