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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly