Eliminated swap counting, got bubble, selection, and insertion sort working

This commit is contained in:
2020-05-31 09:49:28 -05:00
parent c680ec7671
commit 4574231dcb
15 changed files with 1111303 additions and 75 deletions

View File

@@ -22,24 +22,18 @@ public class SortResult {
private String sortType;
private Integer [] sortedArray;
private String comparisonsUsed;
private String swapsUsed;
// private String swapsUsed;
private Duration timeUsed;
public SortResult(String st, Integer[] a, long c, long s, Duration t){
public SortResult(String st, Integer[] a, long c, Duration t){
sortType = st;
sortedArray = a;
if(c==0){
comparisonsUsed = "None";
comparisonsUsed = "No";
}
else{
comparisonsUsed = Long.toString(c);
}
if(s==0){
swapsUsed = "None";
}
else{
swapsUsed = Long.toString(s);
}
timeUsed = t;
}
@@ -48,7 +42,6 @@ public class SortResult {
sortedArray = a;
timeUsed = t;
comparisonsUsed = "Unknown";
swapsUsed = "Unknown";
}
public String getSortType(){
@@ -67,8 +60,8 @@ public class SortResult {
return comparisonsUsed;
}
public String getSwapsUsed(){
return swapsUsed;
}
//public String getSwapsUsed(){
//return swapsUsed;
//}
}