Question: Analysis of algorithm help Heaps with links In class we showed how heaps can be implemented using an array. In this problem we consider using

Analysis of algorithm help

Analysis of algorithm help Heaps with links In class we showed how

Heaps with links In class we showed how heaps can be implemented using an array. In this problem we consider using an implementation using pointers. Consider storing a heap as a linked binary tree with pointers. Give pseudocode on how you would store a heap node, and which modifications you need to make to the heap routines that we discussed in class. What are the runtimes of the heap routines? Now consider storing a heap as a linked list with pointers. Give pseudo-code on how you would store a heap node, and which modifications you need to make to the heap routines that we discussed in class. What are the runtimes of the heap routines? Which of the three heap implementations (array, linked tree, linked list) is preferable? Assume you are given two heaps of height h each, that are given as linked binary trees. And assume we do not require that the last level of the heap is "flushed left", i.e., keys can be in any place in the last level. Give an efficient algorithm that merges those two heaps into one heap (without the "flushed left" condition). Analyze the runtime of your algorithm

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!