Beispiel #1
0
        static void Main(string[] args)
        {
            bubble = new BubbleSort();
            values = new int[SIZE];

            Random rnd = new Random();

            for (int i = 0; i < SIZE; i++)
            {
                values[i] = rnd.Next(100);
            }

            values = bubble.GenerateBubbleSort(values);

            Console.WriteLine(" --- Without Tree --- ");
            for (int i = 0; i < values.Length; i++)
            {
                Console.WriteLine(values[i]);
            }
            Console.WriteLine("\n\n --- With Tree --- ");

            Tree tree = new Tree();

            root = tree.create(values);

            Console.WriteLine("\n\n");

            Print(ref root);
            Console.Read();
        }
Beispiel #2
0
        static void Print(ref Tree.Node node)
        {
            if (node.leftNode != null)
            {
                Print(ref node.leftNode);
            }

            Console.WriteLine(node.key + " : " + node.value);

            if (node.rightNode != null)
            {
                Print(ref node.rightNode);
            }
        }