Heaps Flashcards

1
Q

Describe Order Property for a heap.

A

In a heap, the parent node is always larger (in the
case of a maxheap) or smaller (in the case of a
minheap) than its children.

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

Describe Shape Property for a heap.

A

A heap is always complete; at any point, each
level of the tree is completely filled, except for the
last level which may be filled from left to right with
no gaps

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

At what index of a heap is the root stored?

A

index 1

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

At what index is the left child of any node at index i?

A

2 * i

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

At what index is the right child of any node at index i?

A

2 * i + 1

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

At what index is the parent of a node at index i?

A

i / 2

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