calculating height of a binary tree python code example
Example: find height of binary search tree python
def getHeight(self,root):
return -1 if root is None else 1 + max(self.getHeight(root.left), self.getHeight(root.right))
def getHeight(self,root):
return -1 if root is None else 1 + max(self.getHeight(root.left), self.getHeight(root.right))