notes variables are allocated in the space of initialized static variablesthe local variables of procedure are allocated in the procedure' activation recordwhich is typically found in the processor stackand dynamically allocated variables are allocated in the heap in this unitthe term heap is taken to mean the storage pool for dynamically allocated variables consider heaps and heap-ordered trees in the context of priority queue implementations while it may be possible to use heap to manage dynamic storage pooltypical implementations do not in this contextthe technical meaning of the term heap is closer to its dictionary definition-" pile of many things binary tree has the heap property iff it is empty or the key in the root is larger than that in either child and both subtrees have the heap property heap can be used as priority queuethe highest priority item is at the root and is trivially extracted but if the root is deletedyou are left with two sub-trees and you must efficiently re-create single tree with the heap property the value of the heap structure is that you can both extract the highest priority item and insert new one in (logntime binary heaps binary heap is heap-ordered binary tree which has very special shape called complete tree as result of its special shapea binary heap can be implemented using an array as the underlying foundational data structure array subscript calculations are used to find the parent and the children of given node in the tree and since an array is usedthe storage overhead associated with the subtree fields contained in the nodes of the trees is eliminated complete trees complete trees and perfect trees are closely relatedyet quite distinct as pointed out in the preceding unita perfect binary tree of height has exactly + internal nodes sincethe only permissible values of are + there is no perfect binary tree which containssay or nodes howeveryou want data structure that can hold an arbitrary number of objects so you cannot use perfect binary tree insteadyou use complete binary treewhich is defined as followsdefinition (complete binary treea complete binary tree of height > is binary tree {rtltrwith the following properties if tl and tr for there are two possibilities(atl is perfect binary tree of height - and tr is complete binary tree of height - or (btl is complete binary tree of height - and tr is perfect binary tree of height - figure shows an example of complete binary tree of height four notice that the left subtree of node is complete binary tree of height threeand the right subtree is perfect binary tree lovely professional university