Currently what this function is doing is sorting an array using BucketSort. The array is going to be with numbers between 0 and 999. However instead of that I want to split every bucket into 10 other buckets until i am left with single digits, so basically 3 times. However I struggle to cycle through every bucket. Does anybody have any idea how to do this?
void bucketSort(int arr[], int size, int divider)
{
int max, bucket = 10, i, j, k;
int B[bucket][size];
int B_size[10];
max = getMax(arr, size);
for(i = 0; i < 10; i++)
{
B_size[i] = 0;
}
//insert element in buckets
for(i = 0; i < size; i++)
{
j = floor( arr[i] / divider );
B[j][B_size[j]] = arr[i];
B_size[j]++;
}
//sort elements in buckets
for(i = 0; i < bucket; i++)
{
quickSort(B[i], 0, B_size[i] - 1);
}
//bring elements back
k = 0;
for(i = 0; i < bucket; i++)
{
for(j = 0; j < B_size[i]; j++)
{
arr[k++] = B[i][j];
}
}
}
`