Give an algorithm to insert a new item into the 2-d heap


The 2-d heap is a data structure that allows each item to have two individual keys. deleteMin can be performed with respect to either of these keys. The 2-d heap is a complete binary tree with the following order property: For any node at even depth, the item stored at has the smallest key #1 in its subtree, while for any node at odd depth, the item stored at has the smallest key #2 in its subtree.

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

b. How do we ?nd the item with minimum key #1?

c. How do we ?nd the item with minimum key #2?

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

e. Give an algorithm to perform deleteMin with respect to either key.

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

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Give an algorithm to insert a new item into the 2-d heap
Reference No:- TGS01274808

Expected delivery within 24 Hours