GATE CSE 2019 Q50: True statements about max-heaps and binary search trees
- Programming and Data Structures
- 2 marks
- MCQ
- −2/3 if wrong
Syllabus topic: Trees, binary search trees and binary heaps
Question
Consider the following statements:
I. The smallest element in a max-heap is always at a leaf node
II. The second largest element in a max-heap is always a child of the root node
III. A max-heap can be constructed from a binary search tree in time
IV. A binary search tree can be constructed from a max-heap in time
Which of the above statements are TRUE?
Try it: multiple choice: exactly one correct option
Show answer and explanation
Answer: A (official GATE 2019 final answer key)
Concept used: Heap order puts every element above its descendants only, so a heap can be built from any array in , but a heap carries too little order to build a BST faster than sorting, which needs .
First step: Test I and II with the heap property (a parent is at least each child); for III and IV, ask whether a linear-time conversion would let you sort in linear time.
Full step-by-step solution
Loading…
Answer from the official final answer key. Found a mistake? Use Report issue and we will fix it.
More questions on Trees, binary search trees and binary heaps
Every PYQ on this topic →Share this question
Source: official GATE 2019 CS question paper and final answer key, organised by IIT Madras. Question paper · Answer key
More Programming and Data Structures PYQs
- 2026 Session 1 · Q23Non-leaf indices in a 1-indexed binary heap with n odd
- 2026 Session 1 · Q24Empty slots after linear-probing inserts with h(x) = (x+7) mod 11
- 2026 Session 1 · Q33Maximum height of a full binary tree with 23 nodes
- 2026 Session 1 · Q34Output of a C function with a shadowed block variable
- 2026 Session 1 · Q39Recursive length of a non-empty singly linked list
- 2026 Session 1 · Q40Third insertion that can never yield a complete BST of 1..15