예제 #1
0
        public static void FirstProcess()
        {
            MyBinaryTree myTree = new MyBinaryTree();

            myTree.Input();

            Console.Write("Count: ");
            Console.WriteLine(myTree.Count);

            Console.Write("Height: ");
            Console.WriteLine(myTree.Height);

            Console.Write("So Luong Lode La Trong Cay: ");
            Console.WriteLine(myTree.CountLeaf(myTree.Root));

            Console.Write("NLR: ");
            myTree.PreOrder();
            Console.WriteLine();

            Console.Write("LNR: ");
            myTree.InOrder();
            Console.WriteLine();

            Console.Write("LRN: ");
            myTree.PostOrder();
            Console.WriteLine();

            Console.WriteLine();
            myTree.ListByLevel();
            Console.WriteLine();
            myTree.ListLastLevel();
        }
예제 #2
0
        public static void Remove()
        {
            /* Xóa Node trong cây */
            MyBinaryTree myTree = new MyBinaryTree();

            myTree.Input();

            Console.Write("LNR: ");
            myTree.InOrder();
            Console.WriteLine();

            Console.Write("Nhap Node Can Xoa: ");
            int x = int.Parse(Console.ReadLine());

            myTree.Remove(x);

            Console.Write("LNR: ");
            myTree.InOrder();
            Console.WriteLine();
        }