...
Computer-Networks
October 9, 2023
Computer-Networks
October 9, 2023
Computer-Networks
October 9, 2023
Computer-Networks
October 9, 2023

Data-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

A
i-1
B
⌊i/2⌋
C
⌈i/2⌉
D
(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
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
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!