deleteMax at logarithmic cost. The structure is identical to the binary heap. The min–max heap-order property is that for any node X at even depth, the key stored at X is the smallest in its subtree,...


deleteMax at logarithmic cost. The structure is identical to the binary heap. The min–max heap-order property is that for any node X at even depth, the key stored at X is the smallest in its subtree, whereas for any node X at odd depth, the key stored at X is the largest in its subtree. The root is at even depth. Do the following.


a. Draw a possible min–max heap for the items 1, 2, 3, 4, 5, 6, 7, 8, 9, and 10. Note that there are many possible heaps.


 b. Determine how to find the minimum and maximum elements.


c. Give an algorithm to insert a new node into the min–max heap.


d. Give an algorithm to perform deleteMin and deleteMax.


e. Give an algorithm to perform buildHeap in linear time.

Nov 25, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here