I am learning about bucket sort and it seems a lot of the material insist that it is efficient when the key values are "uniformly distributed and when used to sort integers from a known range". I understand the uniformly distributed part, but do you have to know the range too? If the range is not provided, when creating the auxiliary array during bucket sort, could you instead simply create a dynamic array (ArrayList) which can expand by itself?
If you don't know range and meet value 1000000 - does it belong to the first bucket? to the 10-th bucket? to the 1000th bucket?
Say you believe it belongs to the 10-th bucket (every bucket refers to 100000 values). But next value is 10 000 000 and you need to make 100 buckets. Next one is 1 000 000 000 and now you need 10000 buckets (most of them are empty!)...
Knowing value range and distribution helps to organize right bucket structure to provide the best sorting time.