GATE-2024-CS1(Forenoon)
January 3, 2025
Web-Technologies
January 3, 2025
GATE-2024-CS1(Forenoon)
January 3, 2025
Web-Technologies
January 3, 2025

Data-Structures

Question 13

A max-heap is a heap where the value of each parent is greater than or equal to the value of its children. Which of the following is a max-heap?

A
B
C
D
Question 13 Explanation: 
Heap is a complete binary tree
Option A: It violates the property of complete binary tree.
Option C: 8 is greater than 5. The root value is always greater than his children. So, the above tree is violating the property of max heap.
Option D: 10 is greater than 8. The root value is always greater than his children. So, the above tree is violating the property of max heap.
Correct Answer: B
Question 13 Explanation: 
Heap is a complete binary tree
Option A: It violates the property of complete binary tree.
Option C: 8 is greater than 5. The root value is always greater than his children. So, the above tree is violating the property of max heap.
Option D: 10 is greater than 8. The root value is always greater than his children. So, the above tree is violating the property of max heap.

Leave a Reply

Your email address will not be published. Required fields are marked *