Discrete Mathematics
The balance factor is a critical measure in binary trees, particularly in binary search trees (BST), that helps maintain their balanced structure. It is defined as the difference in height between the left and right subtrees of a node, calculated as 'height(left subtree) - height(right subtree)'. A balance factor of 0 indicates a perfectly balanced tree, while values of +1 or -1 suggest slight imbalances that can be corrected through rotations during insertion or deletion operations.
congrats on reading the definition of balance factor. now let's actually learn it.