Confused - Height of Binary tree
问题 I'm somewhat confused between the logic of calculating the height of binary tree. Code 1 public static int findHeight(Tree node) { if(node == null) return 0; else { return 1+Math.max(findHeight(node.left), findHeight(node.right)); } } Code 2 public static int findHeight(Tree node) { if(node == null) return -1; else { return 1+Math.max(findHeight(node.left), findHeight(node.right)); } } I think, the second one is correct, since it gives the correct answer for below code :- Tree t4 = new Tree(4