The 2-d heap is a data structure that allows each item to


Question: The 2-D heap is a data structure that allows each item to have two individual keys. The delete Min operation can be performed with respect to either of these keys. The 2-D heap-order property is that for any node X at even depth, the item stored at X has the smallest key #1 in its subtree, and for any node X at odd depth, the item stored at X has the smallest key #2 in its subtree. Do the following.

a. Draw a possible 2-D heap for the items (1, 10), (2, 9), (3, 8), (4, 7), and (5, 6).

b. Explain how to find the item with minimum key #1.

c. Explain how to find the item with minimum key #2.

d. Give an algorithm to insert a new item in the 2-D heap.

e. Give an algorithm to perform delete Min with respect to either key.

f. Give an algorithm to perform build Heap in linear time.

Solution Preview :

Prepared by a verified Expert
Data Structure & Algorithms: The 2-d heap is a data structure that allows each item to
Reference No:- TGS02462726

Now Priced at $20 (50% Discount)

Recommended (94%)

Rated (4.6/5)