 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
A
tree is balanced
|
|
|
|
– |
if
its balance factor is zero and its subtrees are
|
|
|
also
balanced
|
|
|
|
– |
but,
since this definition occurs so seldom, an
|
|
|
|
alternate
definition is more generally applied:
|
|
|
|
– |
a
binary tree is balanced if the height of its
|
|
|
|
subtrees
differs by no more than one (i.e., the
|
|
|
|
balance
factors can be -1, 0, or 1) and its
|
|
|
|
subtrees
are also balanced.
|
|