I'm attempting to write an algorithm that creates groups of people based on their 'score'. A person has two paramaters, a name and a score. (The range of the score is between -10 and 10 but that's really not relevant) I'm looking to create groups with equal numbers of people (if possible based on the number of people presented) where the average score of the group members is the same (or very close to the same).
For example:
Group 1 (Average Score=2) -- John Doe, Score 2 -- Jane Doe, Score 7 -- Jack Black, Score -3
Group 2 (Average Score=2) -- Bobby Flay, Score 4 -- Cary Page, Score -3 -- Linus Tarval, Score 5