AVL Tree Implementation

Source: Internet
Author: User

1. Definition

An AVL tree is a 1 of the height of the right subtree of each node of the Saozi two-fork lookup tree (the height of the empty tree is defined as-1)

In an AVL tree with height H, the minimum number of nodes is given by S (h) =s (h-1) +s (h-2) +1. The function S (h) is related to the Fibonacci number.

The Re-balancing node is called a after the insert operation. The imbalance has 4 cases:

(1) Insert the left sub-tree of A's left son

(2) Insert the right sub-tree of A's left son

(3) Insert the left sub-tree of A's right son

(4) Insert the left sub-tree of A's right son

Wherein (1) (4) The situation is adjusted by single rotation, (2) (3) by double rotation to adjust

AVL Tree Implementation

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.