In an AVL tree, the balance factor of a node is the difference between the…
2025
In an AVL tree, the balance factor of a node is the difference between the heights of its:
- A.
Left and right subtrees
- B.
Left subtree and parent
- C.
Right subtree and parent
- D.
Left and right children
Attempted by 365 students.
Show answer & explanation
Correct answer: A
Explanation
In an AVL tree, the balance factor of a node is a crucial value used to maintain the tree's balance. It is calculated as the difference between the height of the left subtree and the height of the right subtree.
Formula: Balance Factor = Height(Left Subtree) - Height(Right Subtree)
For a tree to be balanced, the balance factor of every node must be -1, 0, or 1.
हिन्दी उत्तर
एक AVL ट्री में, किसी नोड का बैलेंस फैक्टर ट्री की संतुलन बनाए रखने के लिए एक महत्वपूर्ण मान है। यह नोड के बाएं सब-ट्री की ऊंचाई और दाएं सब-ट्री की ऊंचाई के बीच के अंतर के रूप में गणना किया जाता है।
सूत्र: बैलेंस फैक्टर = बाएं सब-ट्री की ऊंचाई - दाएं सब-ट्री की ऊंचाई
एक ट्री को संतुलित मानने के लिए, प्रत्येक नोड का बैलेंस फैक्टर -1, 0, या 1 होना चाहिए।