0

Suppose that I call a heap* as a heap that does not need to be left aligned at the last level, nor does it need to be full. Now, given a max heap* (which has the analogous property of a max heap-that is, parent's value>child's value), to perform an Extract_Max(), I need to pop the root, and compare its two children and place whichever of its children are larger in the root node. The node occupied by the larger value is vacated, and I consider the children of the now vacant node and place whichever value is bigger in this vacant node, vacating the larger child's node. I keep progressing this way, until the last layer's child is encountered which is when the algorithm gets terminated. If there are $n$ elements in the max heap*, what is the worst case time complexity of the above Extract_Max() algorithm?

  • Language that `Extract_Max()` is from? How does `Extract_Max()` look if this question is agnostic? – zer00ne Sep 13 '22 at 20:21

0 Answers0