public TreeSort(Stack p,WriteOutput w) { tree = new Tree(p); writer = w; inOrder(tree.root); writer.write("The tree sort took " + tree.c + " comparisons"); }
public BruteForceSort(Stack p,WriteOutput w) { this.p = p; writer = w; writer.write("About to sort " + p.toIntArray().Length + " numbers."); insertionSortArray = p.toIntArray(); insertionSort(); printInsertSorted(insertionSortArray); writer.write("The insertion sort took: " + counter + " comparisons\n"); counter = 0; bubbleSortArray = p.toIntArray(); bubbleSort(); printInsertSorted(bubbleSortArray); writer.write("The bubble sort took: " + counter + " comparisons.\n"); counter = 0; }
public static void Main() { Console.Out.WriteLine("Enter an input path: "); String input = Console.In.ReadLine(); Console.Out.WriteLine("Enter an output path: "); String output = Console.In.ReadLine(); try { ReadInput reader = new ReadInput(input); WriteOutput writer = new WriteOutput(output); Stack a = reader.output; Stack t = reader.output; BruteForceSort achilles = new BruteForceSort(a, writer); TreeSort tortoise = new TreeSort(t, writer); writer.close(); } catch (Exception e) { } }