interactive-coding-challenges/graphs_trees/tree_height/height.py

7 lines
191 B
Python
Raw Normal View History

2016-08-14 20:29:25 +08:00
class BstHeight(Bst):
def height(self, node):
if node is None:
return 0
return 1 + max(self.height(node.left),
self.height(node.right))