AVL Tree Examples and Performance
Exercise 9.4 E1, E2 are examples of types of AVL tree question you might see on the final exam
Examples in class, from E2, build AVL tree by insertion:
- A, Z, B, Y, C, X
- A, B, C, D, E, F (sorted input - worst case for normal binary search tree)
- M, T, E, A, Z, G, P (no rotations needed)
- A, Z, B, Y, C, X, D, W, E, V, F
AVL Tree performance
- Average behavior better than random binary search tree
- Close to performance of perfectly balanced tree
- Perfectly balanced tree has height about lg n
- Sparsest possible AVL tree (worst case) has height approx. 1.44 lg n (only about 44% worse than ideal)
- Average AVL tree performance is very close to ideal