AVL trees are self-adjusting, height-balanced binary search trees.
An AVL tree is a binary search tree in which every node is height balanced, that is, the difference in the heights of its two subtrees is at most 1.
Balance factor of each node = height of right subtree at that node - height of left subtree at that node
AVL tree is that it is a binary search tree in which each node has a balance factor of -1, 0, or +1
Binary Search Tree can become arbitrary unbalanced tree
.
A BST can be called an AVL tree if there is no node that has subtree differing in height with more than one.
No comments:
Post a Comment