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; }