Heaps are favourite data structures for many applications:
In a min heap:
- the root store the lowest priority element
In a max heap,
- the root store the highest priority element
Example: a binary max heap (By Ermishin - Own work, CC BY-SA 3.0)
- Useful when repeatedly removing the object with the highest (or lowest) priority.
- A heap is a partially ordered structure