added code to count write operations used

This commit is contained in:
2020-06-02 13:31:55 -05:00
parent 2e8fa28a5a
commit 9597c56c5d
5 changed files with 15 additions and 5 deletions

View File

@@ -21,13 +21,13 @@ public class CountingSorter extends Sorter{
int[] countArray = new int[max-min+1];
for(int e: numbers){
countArray[e-min]++;
wrtiesUsed++;
writesUsed++;
}
int index=0;
for(int i=0;i<countArray.length;i++){
while(countArray[i]!=0){
numbers[index]=i+min;
wrtiesUsed++;
writesUsed++;
index++;
countArray[i]--;
}