Similar questions 4 more →
Heaps & Priority Queues
![Question 14(a), GATE 1991: The complete binary tree has level-order array [1,5,18,7,13,25,20,11,9,15,17,27]. Its edges are 1→(5,18), 5→(7,13), 18→(25,20), 7→(11,9), 13→(15,17), and 25→(27,left only). Identify the data structure.](../../assets/questions/CS-1991-Q63-1.webp)
![Question 14(a), GATE 1991: The complete binary tree has level-order array [1,5,18,7,13,25,20,11,9,15,17,27]. Its edges are 1→(5,18), 5→(7,13), 18→(25,20), 7→(11,9), 13→(15,17), and 25→(27,left only). Identify the data structure.](../../assets/questions/CS-1991-Q63-2.webp)
![Question 14(a), GATE 1991: The complete binary tree has level-order array [1,5,18,7,13,25,20,11,9,15,17,27]. Its edges are 1→(5,18), 5→(7,13), 18→(25,20), 7→(11,9), 13→(15,17), and 25→(27,left only). Identify the data structure.](../../assets/questions/CS-1991-Q63-3.webp)
Answer & solution
Answer: A binary min-heap. (no official key was published)
Two separate conditions identify this tree. First, its shape is complete: all levels above the last are full and the last level fills from left to right. Second, every parent is no greater than either child: for example 1≤5,18; 5≤7,13; 18≤25,20; and 7≤11,9. The minimum element is therefore at the root, and the tree is a binary min-heap.
It is not a binary search tree. For instance, the root's left subtree contains 5 even though 5>1, and the left child 25 of node 18 exceeds its parent. A heap imposes parent-child order but imposes no sorted order between siblings or across unrelated subtrees. The level-order array in the prompt fully specifies the source figure and provides the customary compact heap representation.