heaps 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 thusit' 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 note don' 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 +introduction to heaps heap is binary tree with these characteristicsit' complete this means it' completely filled inreading from left to right across each rowalthough the last row need not be full figure shows complete and incomplete trees it' (usuallyimplemented as an array we described in "binary trees,how binary trees can be stored in arraysrather than using references to connect the nodes each node in heap satisfies the heap conditionwhich states that every node' key is larger than (or equal tothe keys of its children acomplete figure bincomplete complete and incomplete binary trees figure shows heap and its relationship to the array used to implement it the array is what' stored in memorythe heap is only conceptual representation notice that the tree is complete and that the heap condition is satisfied for all the nodes