Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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)

share|improve this question

2 Answers 2

This is bucket sort.

share|improve this answer

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$

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.