public int GetDepth() { if (node == null) { return(0); } return(node.GetDepth()); }
// Return the number of layers (including this layer) public int GetDepth() { int max = 0; if (left != null) { max = left.GetDepth(); } if (right != null) { max = Mathf.Max(max, right.GetDepth()); } return(1 + max); }