PriorityQueue

Tree Implementation

We are going to explore a tree-based implementation of PriorityQueue. This implementation is called a Binary Heap (or simply a Heap).

A heap has the following properties:

The structure property implies the height of the tree is $O(\lg n)$.

The order property implies the “best” element is always at root.