Question:
In an AVL tree, the balance factor of every node must be in the range of:
एक AVL ट्री में प्रत्येक नोड का संतुलन कारक (Balance Factor) किस सीमा में होना चाहिए?
Options:
- \(\{-1, 0, +1\}\)
- \(\{-2, -1, 0, 1, 2\}\)
- \(\{0, 1\}\)
- \(\{-1, 1\}\)
- \(\{-1, 0, +1\}\)
- \(\{-2, -1, 0, 1, 2\}\)
- \(\{0, 1\}\)
- \(\{-1, 1\}\)
Correct Answer: a)
Explanation:
An AVL tree is a strictly self-balancing binary search tree where the balance factor of each node, defined as \(\text{Height}(\text{Left Subtree}) – \text{Height}(\text{Right Subtree})\), must always be in the set \(\{-1, 0, +1\}\). If it becomes \(\pm 2\), rotations (LL, RR, LR, RL) are executed to restore balance.
AVL ट्री एक स्व-संतुलित बाइनरी सर्च ट्री है जिसमें प्रत्येक नोड का बैलेंस फैक्टर (बाएं सबट्री की ऊंचाई – दाएं सबट्री की ऊंचाई) हमेशा \(\{-1, 0, +1\}\) के बीच होना चाहिए।