Question: 2 7 . Write the code to [ enqueue | dequeue ] from a priority queue stored as [ a sorted dynamic array | an

27. Write the code to [enqueue | dequeue] from a priority queue stored as [a sorted dynamic array | an unsorted linked list | a heap]. Make sure to maintain the optimal Big-O for the given queue storage. 28. How can you determine the [min | max] value in a heap? Show the steps to remove the [min | max] value from the heap. Show the steps to insert a value into a heap and keep the heap order. 29. Given an array representation of binary heap, show the corresponding tree structure. Given a binary heap tree representation, show the corresponding array assuming root is at index [0|1].30. What is the difference between "delete" in a heap and "delete" in other types of trees we discussed in class? 31. Explain how heapsort is O(n lg n) and can be done "in place". 32. Given an array of numbers, show the steps of the optimal heapify algorithm.

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