# HEAP In Data Structure

Hello Friends, In this blog post I am going to let you know about an interesting topic that is a heap. The term heap can be defined as follows- A heap of size n is a binary tree of n nodes that satisfies the following two constraints:

The binary tree is almost complete which means there is an integer such that every leaf of the tree is at level k or k+1 and if a node has a right descendent at level k+1 then that node also has a left descendent at level k+1.

The keys in the nodes are arranged such that the content of each node is less than or equal to the contents of its father. Which means for each node info[i]<= info[j] where j is the father of node i.

This condition means that the level of the heap is filled left to right and that a node is not placed on a new level until the preceding level is full. All the binary trees of fig 1 are heaps.

In the case of any queries, you can write to us at a5theorys@gmail.com we will get back to you ASAP.

Hope! you would have enjoyed this post about heap.

Please feel free to give your important feedbacks in the comment section below.

Have a great time! Sayonara!