Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please write a detailed explaination of why :-) Which types of priority queue im

ID: 3886711 • Letter: P

Question

Please write a detailed explaination of why :-)

Which types of priority queue implementation should be used when 1. The only time-critical operation is removing the maximum (for instance, when items are inserted slowly over a period of days, but at some point need to be removed and processed in order quickly?) 2. Both insertion and removing maximum are equally time-critical. 3. Only insertion is time-critical. For instance, the priority queue is used to log events in case of rare failures In normal operations the priority queue is discarded at regular intervals. a) Unordered Array b) Binary Heap c) Ordered Array a) Ordered Array b) Binary Heap c) Unordered Array a) Binary Heap b) Unordered Array c) Ordered Array

Explanation / Answer

According to my opinion following implementation is used for given assumption or problem of Priority Queue implementation:

= 3rd Option

i.e.

a) binary heap b) unordered Array c) ordered array

Explanation;

For the given time critical operation we use the binary heap because there is removing at once. Insertion is performing day by day and removed or processed on same time. As like in binary heap the inserting into the let be of many days or say long time. But we can process all the inserting nodes at the same time as we want. So according to me the binary heap is suitable for 1st operation.

The insertion and removing at same time is possible only on unordered array due to easily implementation with selection sort. Both operations in selection sort type or unordered array is implemented easily. And by using ordered we get only inserted operation but cant get deletion operation . So for rem,oving this kind of cotradictions i will reccommend unordered array for 2nd operation.

In the third operation only the insertion is time critical so we can use ordered method by using insertion sort i.e. only focus on inserting the values not on any other operation and discards the regular intervals at small opperations.

So it is said that the option 3rd i.e. binary heap -> unordered array -> ordered array is suitable.

if there is any query please ask in comments....