Data Structures
The balance factor is a measure used in tree data structures, specifically in self-balancing binary search trees (BSTs), to determine the balance of a node based on the heights of its left and right subtrees. It is calculated as the height of the left subtree minus the height of the right subtree. A balance factor helps maintain the properties of a balanced tree, ensuring that operations such as insertion, deletion, and lookup remain efficient.
congrats on reading the definition of balance factor. now let's actually learn it.