> See also:
> - [[Tree Data Structures]]
# Heap Data Structure
In a heap structure, the root of each sub tree must be the highest priority node within its sub tree
**Advantages:**
- Easier implementation than AVL Trees
- Percolate (Bubbling up higher priority values through repeated swaps)
- Requires an exponential amount of nodes in the prior layer/level before moving to the new one
- The bottom most row will contain more nodes than all other rows in the tree combined (Shifts average runtime to O(1) as half of the )
- Dequeue
- Swap highest priority with one of the lower priority leaf nodes. Fix structure of tree by *percolating down* to correct priority order
![[Min and Max Heaps.png]]