/** * Runs algorithm on various list sizes with various algorithms. TODO: Make use of input * parameters. * * @param args */ public static void runSortingAlgorithms(String[] args) { // Sorter[] s = {new BubbleSort(args)}; // Sorter[] s = {new ExchangeSort(args), // new InsertionSort(args), new MergeSort(args),new QuickSort(args), new SelectionSort(args)}; Sorter[] s = {new QuickSort(args), new MergeSort(args)}; String outputName = "algtimings11.csv"; int[] listSizes = new int[] { 100, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 25000, 50000, 75000, 100000 }; s[0].hybrid(new SelectionSort(), 7); s[1].hybrid(new SelectionSort(), 7); Integer[][] lists = new Integer[listSizes.length][listSizes.length]; for (int i = 0; i < listSizes.length; i++) { lists[i] = getIntArray(listSizes[i] + ".csv"); } int numTests = 6; for (Sorter s1 : s) { for (int j = 0; j < lists.length; j++) { // Lists for (int k = 0; k < numTests; k++) { // number of interations s1.sort(lists[j].clone()); DataFeed.sortWrite(outputName, s1.getData(), lists[j].length); } } } }
public static void makeNewIntCSV(int size) { DataFeed.exportIntCSV(size, size, size + ".csv"); }