InterviewSolution
Saved Bookmarks
| 1. |
Which one of the following array elements represents a binary min heap?(a) 12 10 8 25 14 17(b) 8 10 12 25 14 17(c) 25 17 14 12 10 8(d) 14 17 25 10 12 8My enquiry is from Heap topic in section Heap of Data Structures & Algorithms IThis question was posed to me in an interview. |
|
Answer» RIGHT option is (b) 8 10 12 25 14 17 To explain: A tree is MIN heap when data at every node in the tree is smaller than or equal to it’s children’ s data. So, only 8 10 12 25 14 17 generates REQUIRED tree. |
|