Representation of max-heap sequentially, Data Structure & Algorithms

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.


 

 

 

 

Posted Date: 7/10/2012 6:22:58 AM | Location : United States







Related Discussions:- Representation of max-heap sequentially, Assignment Help, Ask Question on Representation of max-heap sequentially, Get Answer, Expert's Help, Representation of max-heap sequentially Discussions

Write discussion on Representation of max-heap sequentially
Your posts are moderated
Related Questions
Suppose that you want to develop a program that accepts a postfix expression and asks values for variables in the expression. Then you need to calculate the answer for the expressi

What is called the basic operation of an algorithm? The most significant operation of the algorithm is the operation contributing the most to the total running time is known as

By taking an appropriate example explain how a general tree can be represented as a Binary Tree.                                                                    C onversio

Primitive Data Structure These are the basic structure and are directly operated upon by the machine instructions. These in general have dissimilar representations on different

how to creat atm project by using linked list?

You need to write a function that performs multiplication of two numbers in your data structure. Again, remember how you multiply numbers in base 10 and you should be fine. Multipl

In a doubly linked list, also called as 2 way list, each node is divided into 3 parts. The first part is called previous pointer field. It contains the address of the preceding

Explain in detail the algorithmic implementation of multiple stacks.

REPRESENTATION OF ARRAYS This is not uncommon to determine a large number of programs which procedure the elements of an array in sequence. However, does it mean that the eleme

how we will make projects on stack in c?