A heap is a special tree-based data structure where the tree is a complete tree or an almost complete tree which satisfy the heap property. Now, what is heap property? The heap property states that in a heap all the keys of children nodes must be greater than or equal or less than or equal of the key of the parent node. Based on the heap property there are two kinds of heaps:
In the max heap, the key of a node is greater than or equal of all the child nodes and the key of the root is the greatest.
In the max heap, the key of a node is less than or equal of all the child nodes and the key of the root is the minimum.
There are different types of heaps. Some of them are Binary heap, Binominal heap, Fibonacci heap, Leftist heap, K-D heap etc.
Heap is mostly used for the implementation of the priority queue.