Eliminated swap counting, got bubble, selection, and insertion sort working
This commit is contained in:
@@ -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;
|
||||
//}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user