Home »

Avl tree

The meaning of «avl tree»

In computer science, an AVL tree (named after inventors Adelson-Velsky and Landis) is a self-balancing binary search tree. It was the first such data structure to be invented.[2] In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any time they differ by more than one, rebalancing is done to restore this property. Lookup, insertion, and deletion all take O(log n) time in both the average and worst cases, where n {\displaystyle n} is the number of nodes in the tree prior to the operation. Insertions and deletions may require the tree to be rebalanced by one or more tree rotations.

The AVL tree is named after its two Soviet inventors, Georgy Adelson-Velsky and Evgenii Landis, who published it in their 1962 paper "An algorithm for the organization of information".[3]

AVL trees are often compared with red–black trees because both support the same set of operations and take O ( log ⁡ n ) {\displaystyle O(\log n)} time for the basic operations. For lookup-intensive applications, AVL trees are faster than red–black trees because they are more strictly balanced.[4] Similar to red–black trees, AVL trees are height-balanced. Both are, in general, neither weight-balanced nor μ {\displaystyle \mu } -balanced for any μ ≤ 1 2 {\displaystyle \mu \leq {\tfrac {1}{2}}} ;[5] that is, sibling nodes can have hugely differing numbers of descendants.

In a binary tree the balance factor of a n o d e {\displaystyle node} is defined to be the height difference

of its two child sub-trees. A binary tree is defined to be an AVL tree if the invariant

holds for every n o d e {\displaystyle node} in the tree.

A n o d e {\displaystyle node} with BalanceFactor ( n o d e ) < 0 {\displaystyle {\text{BalanceFactor}}(node)<0} is called "left-heavy", one with BalanceFactor ( n o d e ) > 0 {\displaystyle {\text{BalanceFactor}}(node)>0} is called "right-heavy", and one with BalanceFactor ( n o d e ) = 0 {\displaystyle {\text{BalanceFactor}}(node)=0} is sometimes simply called "balanced".

Related Searches

© 2015-2020, Wikiwordbook.info
Copying information without reference to the source is prohibited!
contact us mobile version