The most detailed illustration of the rotation operation of the AVL tree

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.