I have a list of names.
I want to partition this list into groups of a specified size. All groups should be equal to or less than the specified size, with an equal as possible group size across the groups, and as close to the specified size as possible.
What algorithm (Java-esque pseudo code if possible please!) determines the most appropriate group sizes?
For example:
List contains 13 names - max team size 3. Output (group sizes): 3, 3, 3, 2, 2
List contains 13 names - max team size 4. Output: 4, 3, 3, 3
List contains 31 names - max team size 5. Output: 5, 5, 5, 4, 4, 4, 4
List contains 31 names - max team size 6. Output: 6, 5, 5, 5, 5, 5
List contains 31 names - max team size 10. Output: 8, 8, 8, 7