Representation of max-heap sequentially, Data Structure & Algorithms

Assignment Help:

Q. How do we represent a max-heap sequentially? Explain by taking a valid   example.        

Ans:

A max heap is also called as a descending heap, of size n is an almost complete binary tree of n nodes such as the content of each node is less than or equal to the content or matter of its father. If sequential representation of an almost whole binary tree is used, this condition reduces to the condition of inequality.

Info[j] <= info[(j-1)/2] for 0 <= ((j-1)/2) < j <= n-1

It is very much clear from this definition that root of the tree contains the largest element in the heap in the descending heap. Any of the paths from the root to a leaf is an ordered list in the descending order.


 

 

 

 


Related Discussions:- Representation of max-heap sequentially

Standard ways of traversing a graph, Q. Which are the two standard ways of ...

Q. Which are the two standard ways of traversing a graph?  Explain them with an example of each.  Ans:   T he two ways of traversing a graph are written below

Program segment for deletion of any element from the queue, Program segment...

Program segment for deletion of any element from the queue delete() { int delvalue = 0; if (front == NULL) printf("Queue Empty"); { delvalue = front->value;

Write a program to create a hashed file, Write a program to create a hashed...

Write a program to create a hashed file that stores the records currently in the file " data_2013 ". Records should use the same fixed-length schema given previously, and should ag

Binary search tree in ascending order, In order to get the contents of a Bi...

In order to get the contents of a Binary search tree in ascending order, one has to traverse it in In-order

Pseudo code, I need help writing a pseudocode for my assignment can anyone ...

I need help writing a pseudocode for my assignment can anyone help?

An undirected graph g with n vertices and e edges, An undirected graph G wi...

An undirected graph G with n vertices and e edges is shown by adjacency list.  What is the time required to generate all the connected components? O (e+n)

Infix expression into the postfix expression, Q. Convert the given infix ex...

Q. Convert the given infix expression into the postfix expression (also Show the steps) A ∗ (B + D)/ E - F(G + H / k ) Ans. Steps showing Infix to Post fix

Algorithm, Write an algorithm for compound interest.

Write an algorithm for compound interest.

Java, Ask consider the file name cars.text each line in the file contains i...

Ask consider the file name cars.text each line in the file contains information about a car ( year,company,manufacture,model name,type) 1-read the file 2-add each car which is repr

Pseudocodes, how to write a pseudo code using Kramer''s rule

how to write a pseudo code using Kramer''s rule

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd