Example #1
0
 public int GetDepth()
 {
     if (node == null)
     {
         return(0);
     }
     return(node.GetDepth());
 }
Example #2
0
        // 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);
        }