0% found this document useful (0 votes)
27 views

Dsa Case Study 27

The document discusses AVL trees, a self-balancing binary search tree where the difference between heights of left and right subtrees cannot exceed one. It defines balance factors and describes rotation operations used to rebalance the tree during insertion and deletion. Applications include indexing databases and in-memory collections, while advantages are faster lookups than red-black trees and guaranteed log(N) height. Disadvantages include more complex insertion/deletion and higher processing overhead versus red-black trees.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Dsa Case Study 27

The document discusses AVL trees, a self-balancing binary search tree where the difference between heights of left and right subtrees cannot exceed one. It defines balance factors and describes rotation operations used to rebalance the tree during insertion and deletion. Applications include indexing databases and in-memory collections, while advantages are faster lookups than red-black trees and guaranteed log(N) height. Disadvantages include more complex insertion/deletion and higher processing overhead versus red-black trees.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

CASE STUDY

NAME : JEEVA THAARINI D


REG NO : 210622205027
YEAR : IIND
DEPARTMENT : IT
SUBJECT : DATA STRUCTURES AND
ALGORITHMS
SUB CODE : CD3291
TOPIC : AVL TREE
AVL TREE
An AVL tree defined as a self-balancing Binary Search Tree (BST) where the
difference between heights of left and right subtrees for any node cannot be more than
one.

Balance Factor (k) = height (left(k)) - height (right(k))

If balance factor of any node is 1, it means that the left sub-tree is one level higher than
the right sub-tree.

If balance factor of any node is 0, it means that the left sub-tree and right sub-tree contain
equal height.

If balance factor of any node is -1, it means that the left sub-tree is one level lower than
the right sub-tree.
Operations on an AVL Tree:
➢ Insertion
➢ Deletion
➢ Searching

Left Rotation:
When a node is added into the right subtree of the right subtree, if the tree gets out of
balance, we do a single left rotation.

Right Rotation:
If a node is added to the left subtree of the left subtree, the AVL tree may get out of
balance, we do a single right rotation.

Left-Right Rotation:
A left-right rotation is a combination in which first left rotation takes place after that
right rotation executes.
Right-Left Rotation:
A right-left rotation is a combination in which first right rotation takes place after that
left rotation executes.

Applications of AVL Tree:


➢ It is used to index huge records in a database and also to efficiently search in that.
➢ For all types of in-memory collections, including sets and dictionaries, AVL Trees
are used.
➢ Database applications, where insertions and deletions are less common but
frequent data lookups are necessary
➢ Software that needs optimized search.
➢ It is applied in corporate areas and storyline games.

Advantages of AVL Tree:


➢ AVL trees can self-balance themselves.
➢ It is surely not skewed.
➢ It provides faster lookups than Red-Black Trees
➢ Better searching time complexity compared to other trees like binary tree.
➢ Height cannot exceed log(N), where, N is the total number of nodes in the tree.

Disadvantages of AVL Tree:


➢ It is difficult to implement.
➢ It has high constant factors for some of the operations.
➢ Less used compared to Red-Black trees.
➢ Due to its rather strict balance, AVL trees provide complicated insertion and
removal operations as more rotations are performed.
➢ Take more processing for balancing.

You might also like