GATE | GATE IT 2006 | Question 44
Which of the following sequences of array elements forms a heap?
(A) {23, 17, 14, 6, 13, 10, 1, 12, 7, 5}
(B) {23, 17, 14, 6, 13, 10, 1, 5, 7, 12}
(C) {23, 17, 14, 7, 13, 10, 1, 5, 6, 12}
(D) {23, 17, 14, 7, 13, 10, 1, 12, 5, 7}
Answer: (C)
Explanation:
When they are asking for heap, by default it’s max heap.
Basic Requirement: Array representation of binary tree
Starting from basics lets first understand heap trees We have 2 types of heap – Min heap and Max heap
In Min heap the parent is always smaller than its children and in Max heap parent is always greater than its children.
Looking at the options we can tell that which tree is Max heap tree. Now consider each option one by one and draw a tree
From options it is clear that only option C satisfies the Max heap tree property.
This explanation has been contributed by Parul Sharma.
Quiz of this Question
Recommended Posts:
- GATE | GATE IT 2006 | Question 10
- GATE | GATE-CS-2006 | Question 82
- GATE | GATE-CS-2006 | Question 81
- GATE | GATE-CS-2006 | Question 80
- GATE | GATE-CS-2006 | Question 79
- GATE | GATE-CS-2006 | Question 78
- GATE | GATE-CS-2006 | Question 77
- GATE | GATE-CS-2006 | Question 76
- GATE | GATE-CS-2006 | Question 75
- GATE | GATE-CS-2006 | Question 74
- GATE | GATE-CS-2006 | Question 83
- GATE | GATE-CS-2006 | Question 84
- GATE | GATE IT 2006 | Question 77
- GATE | GATE IT 2006 | Question 78
- GATE | GATE IT 2006 | Question 79





