You are viewing a single comment's thread. Return to all comments →
def levels(node): if node == None: return 0 return 1 + max(levels(node.left), levels(node.right)) def height(root): return levels(root) - 1
Seems like cookies are disabled on this browser, please enable them to open this website
Tree: Height of a Binary Tree
You are viewing a single comment's thread. Return to all comments →
Python 3