The most detailed illustration of the rotation operation of the AVL tree
All the major textbooks are about left and right, in fact, it is easy to understand the error, we change the term.
We call the left-handed: reverse needle rotation.
We call the right-hand rotation: the straight needle rotates.
The usual , directly above the picture.
If I could not understand the rotation of the AVL tree, I could do nothing ...
If there is an error in the picture, please correct me.
Code Article
The implementation of the two-fork find Tree (BST) has been completed in the previous article.
The BST tree can be used directly, and the insert and delete operations are unchanged.
The change is only after inserting and deleting, carries on the backtracking to the root direction, finds the first unbalanced node, in 8 kinds of situations carries on the different rotation.
It can be understood that this unbalanced node must be near the leaf node, which is the case shown in the figure above.
Therefore, the code of the AVL tree is not written in a day or two, and it is slowly filling in the code.
Original blog, reproduced please indicate the source.