Esempio n. 1
0
 public static void printArray(Comparer c, WriteOutput w)
 {
     foreach (int i in c.list)
     {
         w.write(i + ",");
     }
     w.write(c.type + ": " + c.compare);
     w.write(",Is Ordered: " + isOrdered(c.list));
     w.linecharcount = 0;
 }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            A7 a7 = new A7();
            A8 a8 = new A8();

            Console.Out.WriteLine("Enter an input path: ");
            String input = Console.In.ReadLine();
            Console.Out.WriteLine("Enter an output path: ");
            String output = Console.In.ReadLine();
            if (input == "\n" || input == "")
            {
                input = @"C:\Users\parrotch\Documents\Solutions\SELU\CMPS_390\A7_8\A7_8\in\numbers.txt";
            }

            if (output == "\n" || output == "")
            {
                output = @"C:\Users\parrotch\Documents\Solutions\SELU\CMPS_390\A7_8\A7_8\in\output.txt";
            }
            try
            {
                ReadInput reader = new ReadInput(input);
                WriteOutput writer = new WriteOutput(output);
                Stack b = reader.output;
                Stack i = reader.output;
                Stack s = reader.output;
                Stack m = reader.output;
                writer.write("\n");
                printArray(a7.bubbleSort(b.toIntArray()),writer);
                writer.write("\n");
                printArray(a7.insertionSort(i.toIntArray()), writer);
                writer.write("\n");
                printArray(a7.selectionSort(s.toIntArray()), writer);
                writer.write("\n");
                A7_8.A8.MergeSort merger = new A8.MergeSort(m.toIntArray());
                A7_8.A8.BucketSort bucketlove = new A8.BucketSort(m.toIntArray());
                printArray(merger.MergeSorter(), writer);
                writer.write("\n");
                printArray(bucketlove.BucketSorter(), writer);
                writer.write("\n");
                writer.close();
            }
            catch (Exception e)
            { }
        }