AVL vs Heaps Flashcards
1
Q
What is the height of a binary heap?
A
Theta(log(n))
2
Q
How does Insertion work for a heap?
A
Insert at the next available leaf
Fix up until Heap Order property is upheld
3
Q
What is the complexity of Heap Insertion?
A
O(log(n))
4
Q
How does deleteMax for for a Heap?
A
Replace the root by the last leaf
FixDown
5
Q
What is the complexity of deleteMax
A
O(log(n))
6
Q
What is the height of a AVL tree?
A
Theta(log(n))
7
Q
What is the complexity of AVL Insert?
A
BSTInsert -> Theta(log(n))
Update heights above => Theta(log(n))
Rotate if needed => constant
8
Q
What is the complexity of AVLDelete
A
BSTDelete => Theta(log(n))
Updates heights above => Theta(log(n))
Rotate if needed => constant