Max/Min Heap

Heap is a special data structure that has a shape of a complete binary tree (except possibly the deepest internal node) with a special property. We call it ‘Heap Property’.

Heap property
All nodes are either greater than or equal to (for max heap) or less than or equal to (for min heap) each of its children.