Exemplo n.º 1
0
        static void CreateTree(BinaryTree <int> tree, BinaryTreeNode <int> parent, int height)
        {
            if (height == 0)
            {
                return;
            }

            if (rand.Next(height) > 0)
            {
                CreateTree(tree, tree.InsertAsLeftChild(parent, rand.Next(MIN, MAX)), height - 1);
            }

            if (rand.Next(height) > 0)
            {
                CreateTree(tree, tree.InsertAsRightChild(parent, rand.Next(MIN, MAX)), height - 1);
            }
        }