Computer-Networks
October 9, 2023Computer-Networks
October 9, 2023Data-Structures
Question 35 |
Consider any array representation of an n element binary heap where the elements are stored from index 1 to index n of the array. For the element stored at index i of the array (i≤n), the index of the parent is
i-1 | |
⌊i/2⌋ | |
⌈i/2⌉ | |
(i+1)/2 |
Question 35 Explanation:
Parent Node is at index: ⌊i/2⌋
Left Child is at index: 2i
Right child is at index: 2*i+1
Left Child is at index: 2i
Right child is at index: 2*i+1
Correct Answer: B
Question 35 Explanation:
Parent Node is at index: ⌊i/2⌋
Left Child is at index: 2i
Right child is at index: 2*i+1
Left Child is at index: 2i
Right child is at index: 2*i+1
Subscribe
Login
0 Comments