Edges or Nodes?


#1

This compiler is compiling the height based on the nodes. Shouldn’t it be based on Edges? Eg: for one node it returns 1 as height. Shouldn’t it be 0 as there no edges.


#2

It depends on the problem and in this case:

The maximum depth of a binary tree is the number of nodes along the longest path from the root node down to the farthest leaf node.