Heap is a tree-based data structure in which all nodes in the tree are in the specific order. Generally, Heaps can be of two types
Max Heap: all parent node's values are greater than or equal to children node's values, root node value is the largest.
Min Heap: all parent node's values are less than or equal to children node's values, root node value is the smallest.