Ass 2
Ass 2
Namely, the left and right subtrees are of equal height, or their heights
differ by 1. Recall that the height of a tree is the maximum depth (from
the root) of any node. A tree with one node has height 0. We will say
that the empty (null) tree has height -1.
It can be proved that an AVL tree with n nodes has height O(log(n)), and
so any n search/insert/delete operations ensuring worst-case search
cost of O(log(n)). The key idea behind the AVL tree is how a subtree is
re-balanced when a node insertion or removal causes the AVL property
to fail. Like the textbook, we will consider only insertions.
FOR EXAMPLE
Red-back tree