3. The two kinds of heaps #
Created Thursday 08 April 2021
Kinds of heaps #
We have two kinds of priority queues: i.e min-heap and max-heap.
- min heap: pops out the minimum when asked.
- max heap: pops out the maxiumum when asked.
Heap order property: The parent is smaller than its children. MinHeap. The parent is greater than its children. MaxHeap.
- Remember, this is not a BST. So we care only for the parent and children.
- BST cares about left and right, while heap cares only one direction, down.