0
$\begingroup$

I'm trying to assemble a calculation that takes a known number of items (30) and places them into a set number of containers (3) and to calculate that items 1-10 go into container 1, 11-20 go into container 2 and 21-30 go into container 3... over time the number of items will grow infinitely and the number of containers will equal #items/10 (rounded up to the next whole number, so that 35 items would have 4 containers)... Known = # items Known = # containers Items must go into specific containers (items 1-10 must go into container 1, 11-20 into contain 2 and so on)

2 Answers 2

1

This is bucket sort.

0

If you have $I$ items and $C$ containers, the number per container is $N=\lceil \frac{I}{C} \rceil$ Then the bin number for item $m$ is $\lfloor \frac{m-1}{N}\rfloor +1$