Chapter 6: Heapsort Flashcards

1
Q

Heap

A

Basically like a binary tree, representing an array. The indices count from left to right down the different levels of the tree

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

Max-Heap

A

Has the largest element as the root and no parent node can have child nodes larger than itself.

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

The left child of a node at index i in a heap will always be at index…

A

2i

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

The right child of a node at index i in a heap will always be at index…

A

2i + 1

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

Viewing a heap as a tree, we define the height of a node in a heap to be

A

the number of edges on the longest simple downward path from the node to a leaf

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

Height of a binary tree with n elements

A

O(lgn)

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