Vous êtes sur la page 1sur 7

AVL TREES

Problem of indexing with binary trees:

Binary searching requires too many seeks.

Keeping an index in sorted order is expensive.


This is where AVL trees come into picture.
WHATS AN AVL TREE??

AVL tree is a height-balanced tree.


In height_balanced tree there is a limit placed on
the amount of difference allowed between the
heights of any two subtrees sharing a common
root.
The maximum allowalble diffrence in the AVL tree
is ONE.
HB(1) is an AVL tree.
Main features that make AVL trees
important :
By setting a maximum allowable difference in the
height of any two subtrees, AVL trees guarantee a
minimum level of performance in searching.
Maintaining a tree in AVL form as new nodes are
inserted involves the use of a set of four possible
rotations. Each of the rotations is confined to a
single, local area of the tree. The most complex of
the rotations requires only five pointer
reassingnments.
Simpler version of previous slide:
WHY USE AVL TREES??
To reduce the depth of the tree and hence reduce
comparisons while searching for a key or inserting
a key.
By at most five pointer reassignments a new
node is inserted.
AVL trees provide an
acceptable solution for the
problem of keeping index in
sorted order.
THANK YOU!! ;)...

Vous aimerez peut-être aussi