Tuesday, April 12, 2011

Find the hight of a tree

Recursive solution:


Termination condition : treenode==null


1. Find the height of left subtree
2. Find the height of the right sub tree


if height of left subtree is larger
height=height of left subtree +1
else

height=height of right subtree +1

No comments: