AVL tree (balanced binary lookup tree) __ Data structure and algorithm

Source: Internet
Author: User

Reprint to: http://blog.csdn.net/collonn/article/details/20128205

Diagram of the rotation operation of AVL tree most detailed

The major textbooks are all left-handed and right-handed, in fact, it is easy to understand the error, we change the term.
We call left-handed: Reverse needle rotation.
We call the right spin: shun the needle rotation.


The old rules , directly above the picture.

If I can not understand the rotation of the AVL tree, I can do nothing ...

If there are errors in the picture, please correct me.



Code Article

The preceding article has completed the operation of the two-fork lookup tree (BST).

You can use the BST tree directly, and the insert and delete operations will not change.

Only after inserting and deleting, to the root direction of backtracking, to find the first unbalanced node, divided into 8 kinds of conditions for different rotation can be.

Understandably, this unbalanced node must be near the leaf node, which is the case shown above.

Therefore, the AVL tree code is not a day or two can be written out, slowly will fill up the code.

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.