Question:
What is Heap data structure?
Answer:
The binary heap data structures is an array that can be viewed as a complete binary tree. Each node of the binary tree corresponds to an element of the array. The array is completely filled on all levels except possibly lowest. Source: CoolInterview.com
Heap is a binary tree with a property that parent node is largest or smallest of its subtree. It is balanced and almost complete binary tree. It is mostly implemented using array reprentation of binary tree. It is used for sorting arrays. It has order of N*logN. It have consistant performance unlike quick short. It is slower than quick short by twice in normal case. Source: CoolInterview.com
Answered by: Jasvant Singh | Date: 9/10/2009
| Contact Jasvant Singh
1. It is a complete binary tree; that is, each level of the tree is completely filled, except possibly the bottom level. At this level, it is filled from left to right. 2. It satisfies the heap-order property: The data item stored in each node is greater than or equal to the data items stored in its children. Source: CoolInterview.com
Answered by: madhi | Date: 12/28/2009
| Contact madhi
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|