IN Array:
1. ARRAY:
i) insert operation can be implemented by adding an item at end of array in O(1) time .
ii) getHighestPriority operation can be implemented by linearly searching the highest priority item in array. This operation takes O(n) time.
iii) deleteHighestPriority operation can be implemented by first linearly searching an item, then removing the item by moving all subsequent items one position back.
2.Linked List:
time complexity of all operations with linked list remains same as array. The advantage with linked list is deleteHighestPriority can be more efficient as we don’t have to move items.
3.Heap:
i)In a Binary Heap, getHighestPriority can be implemented in O(1) time, insert() can be implemented in O(Logn) time and deleteHighestPriority can also be implemented in O(Logn) time.
ii) fibanooci heap insert() and getHighestPriority can be implemented in O(1) amortized time and deleteHighestPriority can be implemented in O(Logn) amortized time.
Hence Heap is generally preferred for priority queue implementation .