wiz-icon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

Which one of the following array represents a binary max-heap?

A
[26, 15, 14, 17, 11, 9, 13]
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
[26, 13, 17, 14, 11, 9, 15]
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
[26, 15, 17, 14, 11, 9, 13]
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
D
[26, 15, 13, 14, 11, 9, 17]
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is C [26, 15, 17, 14, 11, 9, 13]
For max heap we will compare parent node (i) with its left-child (2×i) and right child (2×i+1);
  • In first option node (2) < node (5) which is violating the max-heap property.
  • In second option node (2) < node (5) which is violating the max-heap property.
  • In third option there is no violation.
  • In fourth option node (3) < node (7) which is violating the max-heap property.

flag
Suggest Corrections
thumbs-up
1
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Properties of Addition and Subtraction of Integers
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon