before after next we insert this causes balance problem at the rootsince its left subtree is of height and its right subtree would be height thereforewe perform single rotation at the root between and before after the rotation is performed by making child of and ' original left subtree the new right subtree of every item in this subtree must lie between and so this transformation makes sense the next item we insert is which causes another rotation before after double rotation the algorithm described above has one problemas figure showsit does not work for cases or the problem is that subtree is too deepand single rotation does not make it any less deep the double rotation that solves the problem is shown in figure the fact that subtree in figure has had an item inserted into it guarantees that it is nonempty thuswe may assume that it has root and two subtrees consequentlythe