示例#1
0
        public void BuildTree(ITreeNode <T> root, int depth)
        {
            var nodeCount = 1;

            NumberOfBallsToRun  = 1;
            ListOfLeafNodeNames = new List <string>();
            for (var i = 1; i <= depth; i++)
            {
                nodeCount         *= 2;
                NumberOfBallsToRun = nodeCount - 1;
                for (var j = 1; j <= nodeCount; j++)
                {
                    var nodeName = i + "-" + j;
                    root = root.AddNode(root, nodeName);

                    if (i == depth)
                    {
                        ListOfLeafNodeNames.Add(nodeName);
                    }
                }
            }
        }