static void Main(string[] args)
        {
            Node root = null;
            Tree bst  = new Tree();
            int  size = 1000000;

            int[] randomData = new int[size];

            Random random = new Random();

            for (int i = 0; i < size; i++)
            {
                randomData[i] = random.Next(10000);
            }

            // For debugging purposes.
            randomData[72] = 512;

            for (int i = 0; i < size; i++)
            {
                root = bst.Insert(root, randomData[i]);
            }

            //bst.Traverse(root);
            Console.WriteLine(bst.TreeDepth(size));
            bst.Search(root, 512);
            Console.ReadKey();
        }
Esempio n. 2
0
        private static void Main()
        {
            Tree TestTree = new Tree();

            Console.WriteLine("Введите количество вершин: ");
            int n = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Введите корень дерева: ");
            TestTree.Insert(Convert.ToInt32(Console.ReadLine()));
            n--;

            while (n != 0)
            {
                Console.WriteLine("Введите вершину: ");
                TestTree.Insert(Convert.ToInt32(Console.ReadLine()));
                n--;
            }

            //TestTree.Insert(8);
            //TestTree.Insert(4);
            //TestTree.Insert(12);
            //TestTree.Insert(2);
            //TestTree.Insert(6);
            //TestTree.Insert(10);
            //TestTree.Insert(14);
            //TestTree.Insert(1);
            //TestTree.Insert(3);
            //TestTree.Insert(5);
            //TestTree.Insert(7);
            //TestTree.Insert(9);
            //TestTree.Insert(11);
            //TestTree.Insert(13);
            //TestTree.Insert(15);

            Console.WriteLine();

            int value = 0;

            int.TryParse(Console.ReadLine(), out value);

            foreach (var val in TestTree.GetLayer(value))
            {
                Console.WriteLine(val);
            }

            Console.ReadKey();
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Tree<int> tree1 = new Tree<int>(10);
            tree1.Insert(5);
            tree1.Insert(11);
            tree1.Insert(5);
            tree1.Insert(-12);
            tree1.Insert(15);
            tree1.Insert(0);
            tree1.Insert(14);
            tree1.Insert(-8);
            tree1.Insert(10);

            foreach (int item in tree1)
                Console.WriteLine(item);
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            Tree <int> TreeOfLife = new Tree <int>(8);

            TreeOfLife.Insert(3);
            TreeOfLife.Insert(1);
            TreeOfLife.Insert(6);
            TreeOfLife.Insert(4);
            TreeOfLife.Insert(7);
            TreeOfLife.Insert(10);
            TreeOfLife.Insert(14);
            TreeOfLife.Insert(15);

            //Console.WriteLine(TreeOfLife.Count);

            /*Console.WriteLine("node = 99 - {0}",TreeOfLife.Properties(99));
             * Console.WriteLine("node = 108 - {0}", TreeOfLife.Properties(108));
             * Console.WriteLine("node = 80 - {0}", TreeOfLife.Properties(80));
             * Console.WriteLine("node = 106 - {0}", TreeOfLife.Properties(106));
             * Console.WriteLine("node = 85 - {0}", TreeOfLife.Properties(85));
             * Console.WriteLine("node = 81 - {0}", TreeOfLife.Properties(81));
             *
             * Console.WriteLine("node = 99 - {0}", TreeOfLife.Properties(99));
             * Console.WriteLine("node = 106 - {0}", TreeOfLife.Properties(106));
             * Console.WriteLine("node = 108 - {0}", TreeOfLife.Properties(108));
             * Console.WriteLine("node = 107 - {0}", TreeOfLife.Properties(107));
             * Console.WriteLine("node = 109 - {0}", TreeOfLife.Properties(109));
             * Console.WriteLine("удаляем 108", TreeOfLife.Delete(108));
             * Console.WriteLine("node = 109 - {0}", TreeOfLife.Properties(109));
             * Console.WriteLine("node = 74 - {0}", TreeOfLife.Properties(74));
             * Console.WriteLine("удаляем 73", TreeOfLife.Delete(73));
             * Console.WriteLine("node = 70 - {0}", TreeOfLife.Properties(70));
             * Console.WriteLine("node = 74 - {0}", TreeOfLife.Properties(74));*/

            /*foreach(var e in TreeOfLife.StepWidth())
             * {
             *  Console.WriteLine(e);
             * }*/

            /*foreach (var e in TreeOfLife.StepDeep())
             * {
             *  Console.WriteLine(e);
             * }*/

            foreach (var e in TreeOfLife.RecursiveStepDeep())
            {
                Console.WriteLine(e);
            }
        }
Esempio n. 5
0
        public void InsertFirstRight()
        {
            Tree theTree = new Tree(new Node()
            {
                Key = 5
            });

            theTree.Insert(6);

            Assert.IsNotNull(theTree.Root);
            Assert.AreEqual(5, theTree.Root.Key);
            Assert.IsNotNull(theTree.Root.Right);
            Assert.AreEqual(6, theTree.Root.Right.Key);
            Assert.IsNull(theTree.Root.Left);
        }
Esempio n. 6
0
 private void MakeTree(int n) // создание дерева, сод. n вершин
 {
     t = new Tree();
     for (int i = 0; i < n; i++)
     {
         if (t.Root == null)
         {
             int r = rnd.Next(50, 61); // корень выбирается из середины диапазона, чтобы дерево было более сбалансированным
             t.Insert(t.Root, r);
         }
         else
         {
             int r = rnd.Next(10, 100);
             // цикл исключает повтор элементов в дереве
             while (t.Root != null && t.Search(t.Root, r) != null)
             {
                 r = rnd.Next(10, 100);
             }
             t.Insert(t.Root, r);
         }
     }
     canvas1.Children.Clear();
     DrawTree(t.Root, canvas1.Width / 2, 20, 150, 60, 30, 0);
 }
Esempio n. 7
0
        static void Main(string[] args)
        {
            Tree tree = new Tree();

            tree.Insert(20);
            tree.Insert(25);
            tree.Insert(15);
            tree.Insert(22);
            tree.Insert(21);
            tree.Insert(17);
            tree.Insert(10);
            Console.WriteLine("Tree length: " + tree.getLenghtRecur(tree.root));
            Console.ReadLine();
        }
        public static void Main(string[] args)
        {
            Node currentNode = null;

            Tree.Insert(ref currentNode, 10);
            Tree.Insert(ref currentNode, 20);
            Tree.Insert(ref currentNode, 15);
            Tree.Insert(ref currentNode, 0);
            Tree.Insert(ref currentNode, 5);

            Console.WriteLine("contains tests:");

            Console.WriteLine($"{Tree.Contains(currentNode, 10) == true} , 10 exists");
            Console.WriteLine($"{Tree.Contains(currentNode, 4) == false} , 4 does not exist");
            Console.WriteLine($"{Tree.Contains(currentNode, 20) == true} , 20 exists");
            Console.WriteLine($"{Tree.Contains(currentNode, 0) == true} , 0 exists");
            Console.WriteLine($"{Tree.Contains(currentNode, 100) == false} , 100 does not exist");

            Console.WriteLine("find min tests:");

            Console.WriteLine($"{Tree.FindMin(currentNode) == 0} , 0 is the minumim");

            Console.WriteLine("find max tests:");

            Console.WriteLine($"{Tree.FindMin(currentNode) == 20} , 20 is the maximum");

            Console.WriteLine("level-order traversal - can be used for printing the tree:");
            Tree.LevelOrder(currentNode);


            Console.WriteLine();
            Console.WriteLine("pre-order traversal");
            Tree.PreOrder(currentNode);


            Console.WriteLine();
            Console.WriteLine("in-order traversal - can be used for sorting the tree:");
            Tree.InOrder(currentNode);


            Console.WriteLine();
            Console.WriteLine("post-order traversal");
            Tree.PostOrder(currentNode);
        }
Esempio n. 9
0
        private void randomTreeBtn_Click(object sender, EventArgs e)
        {
            Tree <int> tree = new Tree <int>();

            Random rand  = new Random(DateTime.Now.Millisecond);
            string order = "";

            for (int i = 0; i < 5; i++)
            {
                int randInt = rand.Next(1, 500);
                tree.Insert(randInt);
                order += randInt + " ";
            }

            consoleTB.Text += "Root: " + tree.Root.Element + Environment.NewLine;
            consoleTB.Text += "Min element: " + tree.FindMin() + Environment.NewLine;
            consoleTB.Text += "Max element: " + tree.FindMax() + Environment.NewLine;
            consoleTB.Text += "Tree: " + tree;

            //string consoleText = consoleTB.Text;
        }
        static void Main()
        {
            Tree tr = new Tree();
            int  k;
            int  m;

            Console.Write("Введите желаемое количество узлов в дереве: ");
            k = int.Parse(Console.ReadLine());
            for (int i = 1; i <= k; i++)
            {
                Console.Write("Введите значение " + i + " узла: ");
                m = int.Parse(Console.ReadLine());
                if (tr.Insert(m))
                {
                    Console.WriteLine("Число " + m + " успешно вставлено в дерево!");
                }
                else
                {
                    Console.WriteLine("Число " + m + " не удалось вставить в дерево, так как оно уже есть в нём!");
                }
            }
            tr.Function_23();
            Console.ReadKey();
        }
Esempio n. 11
0
        static void DoWork()
        {
            Tree<Employee> empTree = new Tree<Employee>(new Employee 
              { Id = 1, FirstName = "Janet", LastName = "Gates", Department = "IT"});
            empTree.Insert(new Employee 
              { Id = 2, FirstName = "Orlando", LastName = "Gee", Department = "Marketing"});
            empTree.Insert(new Employee 
              { Id = 4, FirstName = "Keith", LastName = "Harris", Department = "IT" });
            empTree.Insert(new Employee 
              { Id = 6, FirstName = "Lucy", LastName = "Harrington", Department = "Sales" });
            empTree.Insert(new Employee 
              { Id = 3, FirstName = "Eric", LastName = "Lang", Department = "Sales" });
            empTree.Insert(new Employee 
              { Id = 5, FirstName = "David", LastName = "Liu", Department = "Marketing" });

            Console.WriteLine("All employees");
            var allEmployees = from e in empTree.ToList<Employee>()
                               select e;

            foreach (var emp in allEmployees)
            {
                Console.WriteLine(emp);
            }

            empTree.Insert(new Employee
                               {
                                   Id = 7,
                                   FirstName = "Donald",
                                   LastName = "Blanton",
                                   Department = "IT"
                               });
            Console.WriteLine("\nEmployee added");

            Console.WriteLine("All employees");
            foreach (var emp in allEmployees)
            {
                Console.WriteLine(emp);
            }

            //Console.WriteLine("List of departments");
            ////var depts = empTree.Select(d => d.Department).Distinct();
            //var depts = (from d in empTree
            //             select d.Department).Distinct();

            //foreach (var dept in depts)
            //{
            //    Console.WriteLine("Department: {0}", dept);
            //}

            //Console.WriteLine("\nEmployees in the IT department");
            ////var ITEmployees =
            ////    empTree.Where(e => String.Equals(e.Department, "IT"))
            ////    .Select(emp => emp);
            //var ITEmployees = from e in empTree
            //                  where String.Equals(e.Department, "IT")
            //                  select e;

            //foreach (var emp in ITEmployees)
            //{
            //    Console.WriteLine(emp);
            //}

            //Console.WriteLine("\nAll employees grouped by department");
            ////var employeesByDept = empTree.GroupBy(e => e.Department);
            //var employeesByDept = from e in empTree
            //                      group e by e.Department;

            //foreach (var dept in employeesByDept)
            //{
            //    Console.WriteLine("Department: {0}", dept.Key);
            //    foreach (var emp in dept)
            //    {
            //        Console.WriteLine("\t{0} {1}", emp.FirstName, emp.LastName);
            //    }
            //}
        }
Esempio n. 12
0
        static void Main(string[] args)
        {
            Tree b = new Tree();

            b.Insert(5);
            b.Insert(7);
            b.Insert(7);
            b.Insert(1);
            b.Insert(12);
            b.Insert(32);
            b.Insert(15);
            b.Insert(22);
            b.Insert(2);
            b.Insert(6);
            b.Insert(24);
            b.Insert(17);
            b.Insert(14);

            //b.FindMax();
            b.LesMax();
            //b.DisplayByOrder();
            Console.ReadKey();
        }
        public static void Main(String[] args)
        {
            int  value;
            Tree theTree = new Tree();

            theTree.Insert(50, 1.5);
            theTree.Insert(25, 1.2);
            theTree.Insert(75, 1.7);
            theTree.Insert(12, 1.5);
            theTree.Insert(37, 1.2);
            theTree.Insert(43, 1.7);
            theTree.Insert(30, 1.5);
            theTree.Insert(33, 1.2);
            theTree.Insert(87, 1.7);
            theTree.Insert(93, 1.5);
            theTree.Insert(97, 1.5);

            while (true)
            {
                Console.Write("Enter first letter of show, ");
                Console.Write("insert, find, delete, or traverse: ");
                int choice = GetChar();
                switch (choice)
                {
                case 's':
                    theTree.DisplayTree();
                    break;

                case 'i':
                    Console.Write("Enter value to insert: ");
                    value = GetInt();
                    theTree.Insert(value, value + 0.9);
                    break;

                case 'f':
                    Console.Write("Enter value to find: ");
                    value = GetInt();
                    Node found = theTree.Find(value);
                    if (found != null)
                    {
                        Console.Write("Found: ");
                        found.DisplayNode();
                        Console.Write("\n");
                    }
                    else
                    {
                        Console.Write("Could not find");
                        Console.Write(value + '\n');
                    }
                    break;

                case 'd':
                    Console.Write("Enter value to delete: ");
                    value = GetInt();
                    bool didDelete = theTree.Delete(value);
                    if (didDelete)
                    {
                        Console.Write("Deleted " + value + '\n');
                    }
                    else
                    {
                        Console.Write("Could not delete ");
                        Console.Write(value + '\n');
                    }
                    break;

                case 't':
                    Console.Write("Enter type 1, 2 or 3: ");
                    value = GetInt();
                    theTree.Traverse(value);
                    break;

                default:
                    Console.Write("Invalid Entry\n");
                    break;
                } //end switch
            }     //end while
        }         //end main()
Esempio n. 14
0
        public static void Main(string[] args)
        {
            Tree binaryTree = new Tree();

            binaryTree.Insert(1);
            binaryTree.Insert(7);
            binaryTree.Insert(84);
            binaryTree.Insert(10);
            binaryTree.Insert(18);
            binaryTree.Insert(87);
            binaryTree.Insert(30);
            binaryTree.Insert(58);
            binaryTree.Insert(73);
            binaryTree.Insert(15);
            binaryTree.Insert(91);
            binaryTree.Insert(240);

            Console.WriteLine("\n");

            User_Interface user_Interface = new User_Interface(binaryTree);

            Console.ReadLine();
        }
Esempio n. 15
0
        public static void Main()
        {
            Tree <int> intTree = new Tree <int>(10);

            intTree.Insert(5);
            intTree.Insert(11);
            intTree.Insert(5);
            intTree.Insert(-12);
            intTree.Insert(15);
            intTree.Insert(0);
            intTree.Insert(14);
            intTree.Insert(-8);
            intTree.Insert(10);
            intTree.Insert(8);
            intTree.Insert(8);

            string intSortedData = intTree.WalkTree();

            Console.WriteLine($"Int sorted data is: {intSortedData}");

            Tree <string> stringTree = new Tree <string>("Hello");

            stringTree.Insert("World");
            stringTree.Insert("How");
            stringTree.Insert("Are");
            stringTree.Insert("You");
            stringTree.Insert("Today");
            stringTree.Insert("I");
            stringTree.Insert("Hope");
            stringTree.Insert("You");
            stringTree.Insert("Are");
            stringTree.Insert("Felling");
            stringTree.Insert("Well");
            stringTree.Insert("!");

            string stringSortedData = stringTree.WalkTree();

            Console.WriteLine($"String sorted data is: {stringSortedData}");
        }
        static void Main()
        {
            Tree tr = new Tree();

            if (tr.Insert(43))
            {
                Console.WriteLine("43 вставлено успешно!");
            }
            else
            {
                Console.WriteLine("43 не удалось вставить!");
            }
            if (tr.Insert(143))
            {
                Console.WriteLine("143 вставлено успешно!");
            }
            else
            {
                Console.WriteLine("143 не удалось вставить!");
            }
            if (tr.Insert(42))
            {
                Console.WriteLine("42 вставлено успешно!");
            }
            else
            {
                Console.WriteLine("42 не удалось вставить!");
            }
            if (tr.Insert(43))
            {
                Console.WriteLine("43 вставлено успешно!");
            }
            else
            {
                Console.WriteLine("43 не удалось вставить!");
            }
            if (tr.Insert(45))
            {
                Console.WriteLine("45 вставлено успешно!");
            }
            else
            {
                Console.WriteLine("45 не удалось вставить!");
            }

            if (tr.Delete(45))
            {
                Console.WriteLine("45 удалено успешно!");
            }
            else
            {
                Console.WriteLine("45 не удалось удалить!");
            }
            if (tr.Delete(145))
            {
                Console.WriteLine("145 удалено успешно!");
            }
            else
            {
                Console.WriteLine("145 не удалось удалить!");
            }
            if (tr.Delete(43))
            {
                Console.WriteLine("43 удалено успешно!");
            }
            else
            {
                Console.WriteLine("43 не удалось удалить!");
            }
            if (tr.Delete(43))
            {
                Console.WriteLine("43 удалено успешно!");
            }
            else
            {
                Console.WriteLine("43 не удалось удалить!");
            }
        }
Esempio n. 17
0
        static void Main(string[] args)
        {
            Console.WriteLine("Binary Search Tree\n");

            Tree binaryTree = new Tree();

            binaryTree.Insert(12);
            binaryTree.Insert(30);
            binaryTree.Insert(77);
            binaryTree.Insert(73);
            binaryTree.Insert(59);
            binaryTree.Insert(33);
            binaryTree.Insert(62);
            binaryTree.Insert(85);
            binaryTree.Insert(3);
            binaryTree.Insert(99);
            binaryTree.Insert(100);

            Console.WriteLine("In Order Traversal (Left->Root->Right)");
            binaryTree.InorderTraversal();

            Console.WriteLine("\nFinding 85:");
            var node = binaryTree.Find(85);

            Console.WriteLine(node.Data);

            Console.WriteLine("Delete a Node (62)");
            binaryTree.Remove(62);

            Console.WriteLine("In Order Traversal (Left->Root->Right)");
            binaryTree.InorderTraversal();
        }
Esempio n. 18
0
        static void doWork()
        {
            Tree<Employee> empTree = new Tree<Employee>(
                new Employee { Id = 1, FirstName = "Kim", LastName = "Abercrombie", Department = "IT" }); 
            empTree.Insert(
                new Employee { Id = 2, FirstName = "Jeff", LastName = "Hay", Department = "Marketing" }); 
            empTree.Insert(
                new Employee { Id = 4, FirstName = "Charlie", LastName = "Herb", Department = "IT" }); 
            empTree.Insert(
                new Employee { Id = 6, FirstName = "Chris", LastName = "Preston", Department = "Sales" }); 
            empTree.Insert(
                new Employee { Id = 3, FirstName = "Dave", LastName = "Barnett", Department = "Sales" });
            empTree.Insert(
                new Employee { Id = 5, FirstName = "Tim", LastName = "Litton", Department = "Marketing" });

            Console.WriteLine("All employees"); 
            var allEmployees = from e in empTree.ToList<Employee>() 
                               select e; 
            
            foreach (var emp in allEmployees)
            {
                Console.WriteLine(emp); 
            }

            empTree.Insert(new Employee 
            {
                Id = 7, 
                FirstName = "David",
                LastName = "Simpson",
                Department = "IT"
            });
            Console.WriteLine("\nEmployee added");
            
            Console.WriteLine("All employees");
            foreach (var emp in allEmployees)
            {
                Console.WriteLine(emp);    
            }

            //Console.WriteLine("List of departments"); 
            //// var depts = empTree.Select(d => d.Department).Distinct(); 
            //var depts = (from d in empTree 
            //             select d.Department).Distinct();

            //foreach (var dept in depts) 
            //{
            //    Console.WriteLine("Department: {0}", dept); 
            //}

            //Console.WriteLine("\nEmployees in the IT department"); 
            //// var ITEmployees = 
            ////     empTree.Where(e => String.Equals(e.Department, "IT"))
            ////     .Select(emp => emp); 
            //var ITEmployees = from e in empTree
            //                  where String.Equals(e.Department, "IT") 
            //                  select e;
            
            //foreach (var emp in ITEmployees) 
            //{ 
            //    Console.WriteLine(emp); 
            //}

            //Console.WriteLine("\nAll employees grouped by department"); 
            //// var employeesByDept = empTree.GroupBy(e => e.Department); 
            //var employeesByDept = from e in empTree 
            //                      group e by e.Department;
            
            //foreach (var dept in employeesByDept)
            //{
            //    Console.WriteLine("Department: {0}", dept.Key); 
            //    foreach (var emp in dept)
            //    {
            //        Console.WriteLine("\t{0} {1}", emp.FirstName, emp.LastName); 
            //    }
            //}
        }
Esempio n. 19
0
        static void Main(string[] args)
        {
            Tree theTree = new Tree();

            theTree.Insert(20);
            theTree.Insert(25);
            theTree.Insert(45);
            theTree.Insert(15);
            theTree.Insert(67);
            theTree.Insert(43);
            theTree.Insert(80);
            theTree.Insert(33);
            theTree.Insert(67);
            theTree.Insert(99);
            theTree.Insert(91);
            Console.WriteLine("Inorder Traversal : ");
            theTree.Inorder(theTree.ReturnRoot());
            Console.WriteLine(" ");
            Console.WriteLine();
            Console.WriteLine("Preorder Traversal : ");
            theTree.Preorder(theTree.ReturnRoot());
            Console.WriteLine(" ");
            Console.WriteLine();
            Console.WriteLine("Postorder Traversal : ");
            theTree.Postorder(theTree.ReturnRoot());
            Console.WriteLine(" ");
            Console.ReadLine();
        }
Esempio n. 20
0
        public void TestSortIntegers()
        {
            //this is making a new class w/Tree<TItem>, but specifically for integers
            Tree <int> tree1 = new Tree <int>(4);

            tree1.Insert(5);
            tree1.Insert(11);
            tree1.Insert(5);
            tree1.Insert(-12);
            tree1.Insert(15);
            tree1.Insert(0);
            tree1.Insert(14);
            tree1.Insert(-8);
            tree1.Insert(10);
            tree1.Insert(8);
            tree1.Insert(8);

            string result = tree1.WalkTree();

            Assert.AreEqual(result, "-12, -8, 0, 4, 5, 5, 8, 8, 10, 11, 14, 15");
        }
Esempio n. 21
0
        static void Main(string[] args)
        {
            Tree<int> tree1 = new Tree<int>(10);
            tree1.Insert(5);
            tree1.Insert(11);
            tree1.Insert(5);
            tree1.Insert(-12);
            tree1.Insert(15);
            tree1.Insert(0);
            tree1.Insert(14);
            tree1.Insert(-8);
            tree1.Insert(10);
            tree1.Insert(8);
            tree1.Insert(8);

            string sortedData = tree1.WalkTree();
            Console.WriteLine("Sorted data is: {0}", sortedData);

            Tree<string> tree2 = new Tree<string>("Hello");
            tree2.Insert("World");
            tree2.Insert("How");
            tree2.Insert("Are");
            tree2.Insert("You");
            tree2.Insert("Today");
            tree2.Insert("I");
            tree2.Insert("Hope");
            tree2.Insert("You");
            tree2.Insert("Are");
            tree2.Insert("Feeling");
            tree2.Insert("Well");
            tree2.Insert("!");

            sortedData = tree2.WalkTree();
            Console.WriteLine("Sorted data is: {0}", sortedData);
        }
Esempio n. 22
0
        static void Main(string[] args)
        {
            Tree<int> tree1 = new Tree<int>(10);
            tree1.Insert(5);
            tree1.Insert(11);
            tree1.Insert(5);
            tree1.Insert(-12);
            tree1.Insert(15);
            tree1.Insert(0);
            tree1.Insert(14);
            tree1.Insert(-8);
            tree1.Insert(10);
            tree1.Insert(8);
            tree1.Insert(8);
            tree1.WalkTree();

            Tree<string> tree2 = new Tree<string>("Hello");
            tree2.Insert("World");
            tree2.Insert("How");
            tree2.Insert("Are");
            tree2.Insert("You");
            tree2.Insert("Today");
            tree2.Insert("I");
            tree2.Insert("Hope");
            tree2.Insert("You");
            tree2.Insert("Are");
            tree2.Insert("Feeling");
            tree2.Insert("Well");
            tree2.Insert("!");
            tree2.WalkTree();
        }