Complexity PQ with binary heap
<aside> 📎 * Using a hash table to help optimise these operations does take up linear space and also adds some overhead to be binary heap implementation
</aside>
Complexity analysis of Java Priority Queue
A Heap is a special Tree-based data structure in which the tree is a complete binary tree. Generally, Heaps can be of two types:
A priority queue is an Abstract Data Type (ADT) that operates similar to a normal queue except that each element has a certain priority. The priority of the elements in the priority queue determine the order in which elements are removed from the PQ.
Priority queues only supports comparable data, meaning the data inserted into the priority queue must be able to be ordered in some way either from least to greatest or greatest to least. This is so that we are able to assign relative priorities to each element.
Priority queues are usually implemented with heaps since this gives them the best possible time complexity.