bucketSize = max(1, (max - min) / (n - 1))
.numBuckets = (max - min) / bucketSize + 1
.maxGap
to 0.maxGap
with the difference between the minimum value of the current bucket and the maximum value of the previous bucket, if it's larger than the current maxGap
.maxGap
.