diff --git a/Sorting/AlgorithmTester.java b/Sorting/AlgorithmTester.java index efe8bc0..07b6e6f 100644 --- a/Sorting/AlgorithmTester.java +++ b/Sorting/AlgorithmTester.java @@ -174,7 +174,7 @@ public class AlgorithmTester{ } 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.getWritesUsed()+" write operations"); System.out.println(e.getTimeUsed()+" milliseconds"); diff --git a/Sorting/SortResult.java b/Sorting/SortResult.java index 1dc09a1..e339c7b 100644 --- a/Sorting/SortResult.java +++ b/Sorting/SortResult.java @@ -75,4 +75,14 @@ public class SortResult { 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]); + } + } \ No newline at end of file