Utility function to find height of a tree , rooted at ' root ' .
def height ( root ) : NEW_LINE INDENT if ( not root ) : NEW_LINE INDENT return 0 NEW_LINE DEDENT leftHt = height ( root . left ) NEW_LINE rightHt = height ( root . right ) NEW_LINE return max ( leftHt , rightHt ) + 1 NEW_LINE DEDENT