Problem

A min-max heap is a data structure that supports both deleteMin and deleteMax in O(logN) p...

A min-max heap is a data structure that supports both deleteMin and deleteMax in O(logN) per operation. The structure is identical to a binary heap, but the heaporder property is that for any node, X, at even depth, the element stored at X is smaller than the parent but larger than the grandparent (where this makes sense), and for any node, X, at odd depth, the element stored at X is larger than the parent but smaller than the grandparent. See Figure 1.

a. How do we find the minimum and maximum elements?


b. Give an algorithm to insert a new node into the min-max heap.


c. Give an algorithm to perform deleteMin and deleteMax.


d. Can you build a min-max heap in linear time?


e. Suppose we would like to support deleteMin, deleteMax, and merge. Propose a data structure to support all operations in O(logN) time.

Figure 1: Min-max heap

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 6