Implement the above min-heap structure using an array representation as described in class.

computer science

Description

Consider the following set of elements: 23, 53, 64, 5, 87, 32, 50, 90, 14, 41

 

a.      Construct a min-heap binary tree to include these elements.

b.      Implement the above min-heap structure using an array representation as described in class.

c.      Visit the different array elements in part b and print the index and value of the parent and children of each element visited. Use the formulas for finding the index of the children and parent as presented in class.

d.      Implement the code for inserting the values 44, and then 20 into the min-heap.

e.      Select a random integer in the range [0, array_size-1]. Delete the heap element at that heap index and apply the necessary steps to maintain the min-heap property.

f.       Increase the value of the root element to 25. Apply the necessary steps in code to maintain the min-heap property.

g.      Change the value of the element with value 50 to 0. Apply the necessary steps in code to maintain the min-heap property.

h.      Implement the delete-min algorithm on the heap.

i.       Recursively apply the delete-min algorithm to sort the elements of the heap.

j.       Do some research to list some application domains that uses heap data structures in their realization.

 

Instruction Files

Related Questions in computer science category