예제 #1
0
        public void Test_CountLeaves()
        {
            TestNode root  = new TestNode();
            int      depth = 3;
            int      width = 4;

            CreateTestTree(ref root, depth, width);
            int leavesCount = CountLeaves <int> .Count(root, root);

            Assert.AreEqual((int)Math.Pow(width, depth), leavesCount);

            depth = 8;
            width = 3;
            CreateTestTree(ref root, depth, width);
            leavesCount = CountLeaves <int> .Count(root, root);

            Assert.AreEqual((int)Math.Pow(width, depth), leavesCount);
        }
예제 #2
0
            public Int64 CalculateLeavesCount()
            {
                int leavesCount = CountLeaves <int> .Count(Root, (object)Root);

                return(leavesCount);
            }