Add number range to output
This commit is contained in:
@@ -174,7 +174,7 @@ public class AlgorithmTester{
|
|||||||
}
|
}
|
||||||
System.out.print("\n");
|
System.out.print("\n");
|
||||||
}
|
}
|
||||||
System.out.println("\n"+e.getSortType()+" of "+e.getSortCount()+" numbers took:");
|
System.out.println("\n"+e.getSortType()+" of "+e.getSortCount()+" numbers with range "+e.getMin()+" to "+e.getMax()+" 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");
|
||||||
|
|||||||
@@ -75,4 +75,14 @@ public class SortResult {
|
|||||||
return nf.format(sortedArray.length);
|
return nf.format(sortedArray.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getMin(){
|
||||||
|
NumberFormat nf = NumberFormat.getInstance(Locale.US);
|
||||||
|
return nf.format(sortedArray[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMax(){
|
||||||
|
NumberFormat nf = NumberFormat.getInstance(Locale.US);
|
||||||
|
return nf.format(sortedArray[sortedArray.length-1]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user