I\'m trying to know whether my code is right or wrong with your help, because sadly I can\'t run it to check.
There are no compile errors. What I\'m trying to do is to
In the code in the question, are we not getting height +1? the height is defined as 'length of the path from the root to the deepest node in the tree. A (rooted) tree with only one node (the root) has a depth of zero.'(wikipedia)
if in question's code if give the root to a tree with just 1 node it will give height as 1, which should infact be 0..
Please correct me if i am wrong somewhere..