Complete Binary Trees Flashcards

1
Q

complete binary tree

A

all levels are completely filled in except for the last level which is filled from left to right

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

complete binary tree in array form. how do you find the parent node?

A

integer result of the array index / 2. if node is position 2, parent node is 1. if node is position 3, parent node is 1.

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

complete binary tree in array form. left child node?

A

array index * 2

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

complete binary tree in array form. right child node?

A

array index * 2 plus 1.

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

complete binary tree in array form. how do you find leaf nodes?

A

if n is size of array, any index > n / 2 (integer result) is a leaf node

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

complete binary tree in array form. what’s at the 0th index of the array?

A

empty (or number of nodes)

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