In a balanced binary tree, the height of two sub-trees of every node can not differ by more than

Asked In: BPSC TRE 3.0

Options

  • A. 2
  • B. 1
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. 1

Detailed Explanation

In a height-balanced binary tree such as an AVL tree, the heights of the left and right subtrees of every node differ by at most 1. This difference is represented by the balance factor, commonly calculated as height(left subtree) minus height(right subtree). For an AVL tree, the balance factor of every node must be -1, 0, or +1. If the difference becomes greater than 1, rotations are performed to restore balance.