- A min-max heap is a complete binary tree and often represented in an array.
- Invariants:
- containing alternating min and max levels
- the root is always at min level
- every node at min level is less than all of its descendants
- every node at max level is greater than all of its descendants
- Basic operations:
- insert an element
- find the least/greatest element
- delete the least/greatest element
- Time complexity:
- Insert & deletion: O(lg n)
- getMin & getMax: O(1)