This commit is contained in:
2020-07-03 16:44:10 -05:00
parent fc30b25022
commit 2d0a5f2b5f

View File

@@ -1,6 +1,7 @@
package Sorting; package Sorting;
import java.util.Scanner; import java.util.Scanner;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.InputMismatchException; import java.util.InputMismatchException;
//import java.time.temporal.ChronoUnit; //import java.time.temporal.ChronoUnit;
@@ -196,7 +197,7 @@ public class AlgorithmTester{
int input; int input;
boolean ready=false; boolean ready=false;
boolean print=false; boolean print=false;
String[] sortingAlgoNames = {"selection sort", "insertion sort"}; String[] sortingAlgoNames = {"selection sort", "insertion sort", "quick sort"};
boolean[] sortingAlgoChoices = new boolean[sortingAlgoNames.length]; boolean[] sortingAlgoChoices = new boolean[sortingAlgoNames.length];
System.out.print("\nPlease enter file name: "); System.out.print("\nPlease enter file name: ");
filename = sc.next(); filename = sc.next();
@@ -245,6 +246,7 @@ public class AlgorithmTester{
} }
boolean selection = sortingAlgoChoices[0]; boolean selection = sortingAlgoChoices[0];
boolean insertion = sortingAlgoChoices[1]; boolean insertion = sortingAlgoChoices[1];
boolean quick = sortingAlgoChoices[2];
ArrayList<SortResult> results = new ArrayList<SortResult>(); ArrayList<SortResult> results = new ArrayList<SortResult>();
if(selection){ if(selection){
WordSelectionSorter selSorter = new WordSelectionSorter(reader); WordSelectionSorter selSorter = new WordSelectionSorter(reader);
@@ -254,6 +256,11 @@ public class AlgorithmTester{
WordInsertionSorter inSorter = new WordInsertionSorter(reader); WordInsertionSorter inSorter = new WordInsertionSorter(reader);
results.add(inSorter.measuredSort()); results.add(inSorter.measuredSort());
} }
if(quick){
//put wordquicksorter here
Sorter qSorter = new WordQuickSorter(reader);
results.add(qSorter.measuredSort());
}
for(SortResult e: results){ for(SortResult e: results){
if(e!=null){ if(e!=null){
if(print){ if(print){