joerocket23
Weaksauce
- Joined
- Sep 15, 2007
- Messages
- 88
Hello there,
I am working on a programming assignment that has a question that I am thoroughly stuck on. The assignment is full of problems that we must solve recursively, and this is the one I would really appreciate some help on.
I have a method that creates a number of teams that are as even as possible based on the skill of the players. My method is passed the number of teams I must make, and an array of ints that represents the players "skill". It is called like so:
An example of the fairest teams given those parameters could be:
Team 1: 1 + 3 + 6 = 10
Team 2: 2 + 7 = 9
Team 3: 4 + 5 = 9
In which case my method would return 1, the amount of skills points that the teams are even within.
I am stuck on this because I can't think of what the base case should be. Once I understand this, I will be on my way to solving the rest of the problem.
What would you consider the base case in this problem?
Thanks in advance!
I am working on a programming assignment that has a question that I am thoroughly stuck on. The assignment is full of problems that we must solve recursively, and this is the one I would really appreciate some help on.
I have a method that creates a number of teams that are as even as possible based on the skill of the players. My method is passed the number of teams I must make, and an array of ints that represents the players "skill". It is called like so:
Code:
int[] abilities = {1, 2, 3, 4, 5, 6, 7};
minDifference(3, abilities)
An example of the fairest teams given those parameters could be:
Team 1: 1 + 3 + 6 = 10
Team 2: 2 + 7 = 9
Team 3: 4 + 5 = 9
In which case my method would return 1, the amount of skills points that the teams are even within.
I am stuck on this because I can't think of what the base case should be. Once I understand this, I will be on my way to solving the rest of the problem.
What would you consider the base case in this problem?
Thanks in advance!