Esempio n. 1
0
        static void Main(string[] args)
        {
            //BinarySearchTree tree = new BinarySearchTree();
            //Random random = new Random();
            //for (int i = 20; i < 30; i++)
            //    tree.Add(random.Next(i) - 15);
            //tree.LoadToFile();
            //tree.ReadFromFile();

            //Console.WriteLine(tree.DFS() + "\n-------------------------------------------");
            //tree.InOrderTraversal();
            //Console.WriteLine(tree.DFS() + "\n-------------------------------------------");
            //tree.PreOrderTraversal();
            //Console.WriteLine(tree.DFS() + "\n-------------------------------------------");
            //tree.PostOrderTraversal();
            //Console.WriteLine(tree.DFS() + "\n-------------------------------------------");

            //BinTree bin_tree = new BinTree("1(-2(8*)  1(  1 *) )  ");

            //ThreadedBinTree th_tree = new ThreadedBinTree(bin_tree);
            //th_tree.DFS();
            //Console.WriteLine("-------------------------------------------");
            //th_tree.Connections();

            BinTree bin_tree = new BinTree("1(-2(* 8(* 0))  1 )  ");

            Console.WriteLine("-------------------------------------------");
            ThreadedBinTree th_tree = new ThreadedBinTree(bin_tree);
            th_tree.DFS();
            Console.WriteLine("-------------------------------------------");
            th_tree.Connections();
            Console.WriteLine("-------------------------------------------");
        }
Esempio n. 2
0
 public void Out()
 {
     Console.WriteLine("-------------------------------------------");
     ThreadedBinTree th_tree = new ThreadedBinTree(bin_tree);
     th_tree.DFS();
     Console.WriteLine("-------------------------------------------");
     th_tree.Connections();
     Console.WriteLine("-------------------------------------------");
 }