Exemple #1
0
 def _balance_factor(node):
     '''
     Returns the balance factor of a node.
     '''
     if node is None:
         return 0
     return BinaryTree._height(node.left) - BinaryTree._height(node.right)
Exemple #2
0
 def _balance_factor(node):
     if node is None:
         return 0
     return BinaryTree._height(node.left) - BinaryTree._height(node.right)