Heap is a balanced binary tree data structure where the root-node key is compared with its children and is arranged accordingly. A min-heap, a parent node has a key-value less than its child’s, and a max-heap parent node has a value greater than its child’s.