Question: a) Suppose that the priority queue is implemented as an unsorted list. How would a changePriority operation be implemented in that case? What is the
a) Suppose that the priority queue is implemented as an unsorted list. How would a changePriority operation be implemented in that case? What is the "Big-Theta" run time of the operation? (This is trivial.) b) Suppose that the priority queue is implemented as a sorted list, sorted by priority. How would a changePriority operation be implemented in that case? What is the "Big-Theta" run time of the operation? c) Now suppose that the priority queue is implemented by a heap-which it should be, of course, for efficiency. If you simply change the priority of an item in the heap, the resulting data structure might not satisfy the heap property. Explain how to implement a changePriority operation for a priority queue implemented as a heap. Give a clear and complete explanation or write out an explicit algorithm. What is the "Big-Theta" run time of the operation
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
