I have a list of names.
I want to break this list into groups of a certain size. All groups should be equal to or smaller than the specified size, with the maximum possible group size for the groups and as close as possible to the specified size.
What algorithm (Java-esque pseudo-code, if possible, please!) Determines the most suitable group sizes?
For instance:
The list contains 13 names - the maximum team size is 3. Exit (group sizes): 3, 3, 3, 2, 2
The list contains 13 names - the maximum command size is 4. Exit: 4, 3, 3, 3
The list contains 31 names - the maximum command size is 5. Exit: 5, 5, 5, 4, 4, 4, 4
The list contains 31 names - the maximum size of a command 6. Exit: 6, 5, 5, 5, 5, 5
The list contains 31 names - the maximum command size is 10. Exit: 8, 8, 8, 7