AVL Trees and Balancing Flashcards

1
Q

What is the AVL Tree Property?

A

Vertex x is said to be height-balanced if |x.left.height - x.right.height| <= 1. A BST is said to be height balanced if every vertex in the tree is height balanced. It makes the O(h) operations in BST become O(logn).

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

What is the balance factor?

A

bf(x) = x.left.height - x.right.height
If we get a balance factor of +2, left subtree is taller. If -2, right subtree is taller. This is checked from the insertion point all the way up to the root node.

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