Data Structures Flashcards
1
Q
How to find child nodes of a node in an array heap?
A
Assume idx is index of parent node
child one: 2 * idx + 1
child two: 2 * idx + 2
2
Q
How to find parent node of a node in an array heap?
A
Assume idx is index of child node
parent = floor((idx - 1) / 2)
3
Q
A