what is a heap in algorithm?
Heap sort is a comparison based sorting technique based on Heap data structure. A binary Tree is said to follow a heap property if tree is complete binary tree and every element of the tree is Larger (or Smaller) than any of its descendants if they exists. Depending on the ordering, a heap is called a max-heap or a min-heap. In a Max-heap, the keys of parent nodes are always greater than or equal to those of the children. In max-heap, Largest element of the Tree is always at top(Root Node).