A balanced binary tree is a binary tree in which the depth of the two subtrees of every node never differs by more than one.
Example Code for Balanced Binary Tree Check:
def height(root):
if root is None:
return 0
return 1 + max(height(root.left), height(root.right))
def is_balanced(root):
if root is None:
return True
lh = height(root.left)
rh = height(root.right)
if abs(lh - rh) <= 1 and is_balanced(root.left) and is_balanced(root.right):
return True
return False