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
ESO207: Programming Assignment 1 Due on 6 Sept, 2015. To be submitted online. Problem In this assignment you are required to implement k-way Merge Sort algorithm. In this version p

Q. Explain quick sort? Sort the given array using quick sort method. 24 56 47 35 10 90 82 31

Comparative Study of Linear and Binary Search Binary search is lots quicker than linear search. Some comparisons are following: NUMBER OF ARRAY ELEMENTS EXAMINED array

Double ended queues are implemented along doubly linked lists. A doubly link list can traverse in both of the directions as it contain two pointers namely left pointers and righ

an electrical student designed a circuit in which the impedence in one part of a series circuit is 2+j8 ohms and the impedent is another part of the circuit is 4-j60 ohm mm program

The Linked list is a chain of structures wherein each structure contains data in addition to pointer, which stores the address (link) of the next logical structure in the list.

A linear collection of data elements where the linear node is given by means of pointer is known as Linked list

Illustrate the Visual realism applications a)   Robot Simulations : Visualization of movement of their links and joints  and end effector movement etc. b)  CNC programs ver

how do we use 4-discs stack to solve tower of hanoi problem and write an algorithm to solve it?

Given is the structure of an AVL tree: struct avl { struct node *left; int info; int bf; struct node *right; }; 2) A multiway tree of n order is an ord