editing sort type strings

This commit is contained in:
2020-06-08 12:35:00 -05:00
parent d3398c9b65
commit cb3dca5d62
7 changed files with 9 additions and 8 deletions

View File

@@ -82,7 +82,7 @@ public class AlgorithmTester{
int input; int input;
boolean ready=false; boolean ready=false;
boolean print=false; boolean print=false;
String[] sortingAlgoNames = {"bubble","selection","insertion","counting","quick","3-way partitioned quick","merge"}; String[] sortingAlgoNames = {"bubble sort","selection sort","insertion sort","counting sort","quick sort","quick sort (3-way partition)","merge 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();
@@ -168,8 +168,9 @@ public class AlgorithmTester{
for(int i: e.getSortedArray()){ for(int i: e.getSortedArray()){
System.out.print(i+" "); System.out.print(i+" ");
} }
System.out.print("\n");
} }
System.out.println("\n"+e.getSortType()+" sort of "+e.getSortCount()+" numbers took:"); System.out.println("\n"+e.getSortType()+" of "+e.getSortCount()+" numbers took:");
System.out.println(e.getComparisonsUsed()+" comparisons"); System.out.println(e.getComparisonsUsed()+" comparisons");
System.out.println(e.getWritesUsed()+" write operations"); System.out.println(e.getWritesUsed()+" write operations");
System.out.println(e.getTimeUsed()+" milliseconds"); System.out.println(e.getTimeUsed()+" milliseconds");

View File

@@ -4,7 +4,7 @@ public class BubbleSorter extends Sorter{
//a class to sort arrays of numbers using bubble sort //a class to sort arrays of numbers using bubble sort
public BubbleSorter(String filename){ public BubbleSorter(String filename){
super("bubble", filename); super("bubble sort", filename);
} }
void sort(){ void sort(){

View File

@@ -5,7 +5,7 @@ import java.util.Arrays;
public class CountingSorter extends Sorter{ public class CountingSorter extends Sorter{
public CountingSorter(String filename){ public CountingSorter(String filename){
super("counting", filename); super("counting sort", filename);
} }
void sort(){ void sort(){

View File

@@ -6,7 +6,7 @@ package Sorting;
public class InsertionSorter extends Sorter{ public class InsertionSorter extends Sorter{
public InsertionSorter(String filename){ public InsertionSorter(String filename){
super("insertion", filename); super("insertion sort", filename);
} }
void sort(){ void sort(){

View File

@@ -3,7 +3,7 @@ package Sorting;
public class MergeSorter extends Sorter{ public class MergeSorter extends Sorter{
public MergeSorter(String filename){ public MergeSorter(String filename){
super("merge",filename); super("merge sort",filename);
} }
void sort(){ void sort(){

View File

@@ -3,7 +3,7 @@ package Sorting;
public class QuickSorter extends Sorter{ public class QuickSorter extends Sorter{
public QuickSorter(String filename){ public QuickSorter(String filename){
super("quick", filename); super("quick sort", filename);
} }
public QuickSorter(String qsortVariant, String filename){ public QuickSorter(String qsortVariant, String filename){

View File

@@ -3,7 +3,7 @@ package Sorting;
public class SelectionSorter extends Sorter { public class SelectionSorter extends Sorter {
//a class to sort an array of numbers using selection sort //a class to sort an array of numbers using selection sort
public SelectionSorter(String filename){ public SelectionSorter(String filename){
super("selection", filename); super("selection sort", filename);
} }
void sort(){ void sort(){