Tree: Height of a Binary Tree

  • + 0 comments

    python

    def height(root):
        if root is None:
            return -1
        h_left=height(root.left)
        h_right=height(root.right)
        
        return max(h_left,h_right) +1