Algorithmix.UnitTest.NodeTest.CalculateSize C# (CSharp) 메소드

CalculateSize() 개인적인 정적인 메소드

private static CalculateSize ( INode node ) : int
node INode
리턴 int
        private static int CalculateSize(INode node)
        {
            if (node.Left() != null && node.Right() != null && !node.IsLeaf())
            {
                return CalculateSize(node.Left()) + CalculateSize(node.Right());
                ;
            }

            if (node.Left() == null && node.Right() == null && node.IsLeaf())
            {
                return node.Size();
            }

            throw new Exception("Badly Constructed INode Tree");
        }