What is balance factor of an AVL tree?
2021
What is balance factor of an AVL tree?
- A.
|h(TL)| ≤ 1
- B.
|h(TR)| ≤ 1
- C.
h(TL) – h(TR)| ≤ 1
- D.
|h(TL) + h(TR)| ≤ 1
Attempted by 652 students.
Show answer & explanation
Correct answer: C
The balance factor of a node in an AVL tree is defined as the difference between the heights of its left and right subtrees.
It is calculated as:
For an AVL tree, the balance factor of every node must be -1, 0, or 1. This ensures the tree remains balanced and maintains O(log n) search time.