added code to count number of writes used
This commit is contained in:
@@ -21,11 +21,13 @@ public class CountingSorter extends Sorter{
|
||||
int[] countArray = new int[max-min+1];
|
||||
for(int e: numbers){
|
||||
countArray[e-min]++;
|
||||
wrtiesUsed++;
|
||||
}
|
||||
int index=0;
|
||||
for(int i=0;i<countArray.length;i++){
|
||||
while(countArray[i]!=0){
|
||||
numbers[index]=i+min;
|
||||
wrtiesUsed++;
|
||||
index++;
|
||||
countArray[i]--;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user