Average complexity of an enqueue operation


Question: Suppose we implement a priority queue as a heap. Assume the queue has thousands of elements. Suppose further that we have four different priorities (1-4, highest to lowest). The heap typically has 5% of priority 1 elements, 10% priority 2 elements, 15% priority 3 elements, and 70% of priority 4 elements. The probability of the newly arriving element at priority i, P(i) is P(1) = 0.05, P(2) = 0.10, P(3) = 0.15 and P(4) = 0.7.

a) Find the average complexity of an enqueue operation.

b) Find the average complexity of the dequeue (remove) operation.

Request for Solution File

Ask an Expert for Answer!!
Data Structure & Algorithms: Average complexity of an enqueue operation
Reference No:- TGS0540654

Expected delivery within 24 Hours