Height balance factor is stored in new field introduced by an AVL tree - Data Structure

Q.  Which balance factor is stored in the new field introduced by an AVL tree for the representation of a node?
- Published on 27 Aug 15

a. Length
b. Height
c. Width
d. Information

ANSWER: Height
 

    Discussion

  • Nirja Shah   -Posted on 18 Nov 15
    The height balanced binary search tree is also called AVL tree. An AVL tree is binary search tree where the difference in the height of left and right subtrees of any node can be at most 1.
    In AVL tree possible values for the balance factor of any node are -1, 0, 1.
    Balance factor of a node=Height of its left subtree - Height of its right subtree.
    - If the value of balance factor is -1, then the height of right sub-tree is one more than the height of the left sub-tree with respect to the given node.
    - If the value of balance factor is 0, then the height of right sub-tree is equal to the height of the left Sub-tree with respect to the given node.
    - If the value of balance factor is 1, then the height of right sub-tree is one less than the height of the left sub-tree with respect to the given node

Post your comment / Share knowledge


Enter the code shown above:
 
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)