Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started