heap.h

The Heap is a specialized tree-based data structure which is essentially a complete tree that satisfies the heap property:

MaxHeap

Minheap

The heap is mostly used to implement priority queues. Sometimes it can also be used to sort elements. There are three main functions: