Hide text Hide pseudocode  
Insert the given keys into the initially empty AVLtree. If there are equal keys they are always inserted into the right branch of the existing node.  
1 Do Binary Search Tree Insert (recursive algorithm) 2 While the recursion returns, keep track of
3 If p is unbalanced, do one of the following rotations:
