Question: Problem 3 . ( 3 0 points ) Assume that q refers to a heap - based priority queue which stores its elements using an

Problem 3.(30 points) Assume that q refers to a heap-based priority queue which stores its
elements using an array. Answer each of the following problems.
(a)(10 points) Let [1,2,4,5,6,7, null] denote the array that q uses. Explain how this
array changes when q.add(3) is executed. Briefly justify your answer.
(b)(10 points) Let [1,2,4,5,6,7, null] denote the array that q uses. Explain how this
array changes when q.removeMin() is executed. Briefly justify your answer.
(c)(10 points) Let [1,2,4,5,6,7, null] denote the array that q uses. Explain how this array changes when q.add(0) and then q.removeMin() are executed. Briefly justify your answer.
Problem 3 . ( 3 0 points ) Assume that q refers

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!