Lecture 6 Objectives
At the end of today's class you should
KNOW:
- That a binary search tree (BST) is a binary tree with an invariant
- That the methods that modify a BST are responsible for maintaining the
invariant
- That a BST can give better runtime performance than a list
- That a BST has linear worst-case performance
- That an AVL tree is a BST with the additional invariant that the tree
is height-1 balanced
- That an AVL tree can guarantee logarithmic worst-case performance
BE ABLE TO:
- Show the results of adding or removing an element from a BST
- Show the result of adding an element to an AVL tree
Sample Exam Question:
Given this BST:
14
/ \
/ \
10 36
/ \ \
/ \ \
8 12 92
Draw the BST that would result from removing the element 14. Replacements
should come from the left subtree.