Computer Science, asked by nikki9430, 10 months ago

Explain Avl Tree Program In C

Answers

Answered by Tarun1198
0

Explanation:

AVL tree is a self-balancing Binary Search Tree where the difference between heights of left and right subtrees cannot be more than one for all nodes.

Tree rotation is an operation that changes the structure without interfering with the order of the elements on an AVL tree. It moves one node up in the tree and one node down. It is used to change the shape of the tree, and to decrease its height by moving smaller subtrees down and larger subtrees up, resulting in improved performance of many tree operations. The direction of a rotation depends on the side which the tree nodes are shifted upon whilst others say that it depends on which child takes the root’s place. This is a C++ Program to Implement AVL Tree.

Function Descriptions:

height(avl *) : It calculate the height of the given AVL tree.

difference(avl *): It calculate the difference between height of sub trees of given tree

avl *rr_rotat(avl *): A right-right rotation is a combination of right rotation followed by right rotation.

avl *ll_rotat(avl *): A left-left rotation is a combination of left rotation followed by left rotation.

avl *lr_rotat(avl*): A left-right rotation is a combination of left rotation followed by right rotation.

Similar questions