binary trees figure inserting value into the heap implemented as an array value in the current node and ( the sift-down operation has to be repeated on that child otherwisethe proper position of the value being sifted down has been located and the base case of the recursive operation is reached analysis inserting an item into heap implemented as an array requires (log ntime in the worst case inserting the new item at the end of the sequence of heap items can be done in ( time after the new item is insertedit has to be sifted up the tree the worst case time of the sift-up operation is the maximum number of levels the new item can move up the tree new item always begins in leaf node and may end up in the root nodewhich is distance equal to the height of the tree since heap is complete binary treewe know its height is always log extracting an item from heap implemented as an array also requires (log ntime in the worst casethe analysis of which we leave as an exercise the priority queue revisited priority queuewhich was introduced in works like normal queue except each item is assigned priority and the items with higher priority are