Heap

Heap is a type of balanced binary tree data structure in which the root-node key is compared to its offspring and the data is sorted accordingly. If α has child node β then,

key(α) ≥ key(β)

As the value of parent is greater than that of child, this property generates Max Heap. Based on this criteria, a heap can be of two types −

For Input → 35 33 42 10 14 19 27 44 26 31

Min-Heap − Where the value of the root node is less than or equal to either of its children.

Max Heap Example

Max-Heap − Where the value of the root node is greater than or equal to either of its children.

Max Heap Example

Both trees are constructed using the same input and order of arrival.

0

3,967 thoughts on “Heap”

  1. Hiya, I am really glad I’ve found this information. Nowadays bloggers publish only about gossips and internet and this is really irritating. A good web site with interesting content, that is what I need. Thank you for keeping this web site, I will be visiting it. Do you do newsletters? Cant find it.

    0
  2. Hiya, I am really glad I’ve found this information. Nowadays bloggers publish just about gossips and net and this is actually annoying. A good blog with interesting content, this is what I need. Thank you for keeping this website, I will be visiting it. Do you do newsletters? Cant find it.

    0
  3. You could certainly see your enthusiasm within the paintings you write. The sector hopes for more passionate writers such as you who aren’t afraid to mention how they believe. At all times go after your heart.

    0
  4. Good – I should certainly pronounce, impressed with your website. I had no trouble navigating through all the tabs as well as related information ended up being truly simple to do to access. I recently found what I hoped for before you know it in the least. Quite unusual. Is likely to appreciate it for those who add forums or anything, site theme . a tones way for your client to communicate. Nice task.

    0
  5. Greetings! I’ve been following your weblog for a long time now and finally got the bravery to go ahead and give you a shout out from Austin Tx! Just wanted to mention keep up the fantastic work!

    0
  6. Hi, just required you to know I he added your site to my Google bookmarks due to your layout. But seriously, I believe your internet site has 1 in the freshest theme I??ve came across. It extremely helps make reading your blog significantly easier.

    0
  7. obviously like your website but you have to check the spelling on several of your posts. A number of them are rife with spelling issues and I find it very bothersome to tell the truth nevertheless I’ll certainly come back again.

    0
  8. Heya i am for the first time here. I found this board and I find It really useful & it helped me out much. I hope to give something back and aid others like you helped me.

    0
  9. I haven’t checked in here for a while because I thought it was getting boring, but the last few posts are good quality so I guess I will add you back to my daily bloglist. You deserve it my friend 🙂

    0