Question: Question B) only please This question is about heaps and in this question the Heap is a max Heap. (a) What is the minimum number

Question B) only please This question is about heaps and in thisQuestion B) only please

This question is about heaps and in this question the Heap is a max Heap. (a) What is the minimum number of elements that must be moved during a "retrieve the maximum element operation on a heap? Give an example of a heap with 7 elements for which a "retrieve the maximum element operation will require this minimum number of moves. (b) Provide an implementation of the method delete (self, k) that deletes from a Heap the element at position k. You can assume that the heap's elements are numbers stored in an array called array (with the root at position 1), that you have an instance variable count, and that the Heap has the following methods: sink (self, k) rise (self, k) swap (self, i, j). This question is about heaps and in this question the Heap is a max Heap. (a) What is the minimum number of elements that must be moved during a "retrieve the maximum element operation on a heap? Give an example of a heap with 7 elements for which a "retrieve the maximum element operation will require this minimum number of moves. (b) Provide an implementation of the method delete (self, k) that deletes from a Heap the element at position k. You can assume that the heap's elements are numbers stored in an array called array (with the root at position 1), that you have an instance variable count, and that the Heap has the following methods: sink (self, k) rise (self, k) swap (self, i, j)

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 Accounting Questions!