The behaviour of the lowest bound is actually a Fibonacci sequenc4 of numbers:
Approximate value: $F(h) \approx 1.8944 \phi ^h - 1$ where $\phi\approx 1.6180$
left-right or right-left (zig-zag) imbalanced --> requires double rotation:
Notes:
Insertions is $\Theta(\ln(n))$
For erasing an element, balencing can be $\Theta(h)$ in the worst case.
template<typename Type>
int AVL_node<Type>::height() const {
return empty() ? -1 : ;
}
template<typename Type>
int AVL_node<Type>::insert( .. ){
}
Case 2:
AVL_node<Type> *b = left(),
*d = b->right(),
*DL = d->left(),
*DR = d->right();
d->left_tree = b;
d->right_tree = this;
In [ ]: