Question: Assume we are inserting elements into a max heap structure using the following code: bh = BinaryHeap() bh.insert(40) bh.insert(10) bh.insert(30) bh.insert(20) bh.insert(50) bh.insert(60) Write the

 Assume we are inserting elements into a max heap structure usingthe following code: bh = BinaryHeap() bh.insert(40) bh.insert(10) bh.insert(30) bh.insert(20) bh.insert(50) bh.insert(60)

Assume we are inserting elements into a max heap structure using the following code: bh = BinaryHeap() bh.insert(40) bh.insert(10) bh.insert(30) bh.insert(20) bh.insert(50) bh.insert(60) Write the values in the underlying Python list after the code above finishes execution (you may assume the value at index O is O (and include this value in your answer)). Note: this question will be autograded, so please be EXACT with your answer when writing the underlying Python list state below (same spacing, brackets, commas, etc) as you would see in printing a list to the interactive shell (such as [0, X, Y, Z]). Enter your answer here Assume we are inserting elements into a min heap structure using the following code: bh = BinaryHeap() bh.insert(40) bh.insert(10) bh.insert(30) bh.delmin() bh.insert(20) bh.insert(50) bh.insert(60) bh.delmin() Write the values in the underlying Python list after the code above finishes execution (you may assume the value at index O is 0 (and include this value in your answer)). Note: this question will be autograded, so please be EXACT with your answer when writing the underlying Python list state below (same spacing, brackets, commas, etc) as you would see in printing a list to the interactive shell (such as [0, X, Y, 2])

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!