subject

Creating fair teams. public int mindifference(int numTeams, int[] abilities) { In this question you are passed an int that represents the number of teams we want to form from a group of people. You are also passed an array of ints that represents the ability scores of all of the individuals we want to assign to teams. (It could be athletic ability, IQ, artistic ability, etc.) Abilities can be any integer value. A team's total ability is simply the sum of the ability scores of the people assigned to that team. The goal of this method is to find the minimum possible difference between the team with the maximum total ability and the team with the minimum total ability. The constraints are everyone (represented by a value in the array named abilities) must be placed on a team and every team must have at least one member. You must create the helper method. You must keep track of multiple things such as which element in the abilities array you are currently considering (or which people have already been assigned to a team), what the total ability score is for each team, as well as some way of ensuring each team has at least one member. (You could simply track the number of members per team.) For example if we have the following abilities: [1, 2, 3, 4, 5, 6, 7] and want to form three teams the min difference possible between the team with the maximum total ability and the team with the minimum total ability is 1. Your program does not need to show what the members of each team are but in this example the minimum possible difference is created by having 2 teams with a total ability of 9 and 1 team with 10.(min 9, max 10). There are multiple ways of doing this with these values one of which is: Team 1: 1 + 3 + 6 = 10 Team 2: 2 + 7 = 9 Team 3: 4 + 5 = 9 In this problem there is a lot to do when you reach the base case. You must ensure every team has at least one person on it (or it is an invalid set up), and if it is a valid set up find the min and max team ability scores. If the setup is invalid you must return some value to indicate the set up was invalid or the largest possible difference.. (Integer, MAX_VALUE perhaps?) HINT: If not at the base case (all people assigned to teams), handle one person. The choices for the current person are the teams they could be assigned to.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:30
All of the following are characteristics that must be contained in any knowledge representation scheme except
Answers: 3
question
Computers and Technology, 23.06.2019 09:30
Light travels at a speed of 186,000 miles a second. the distance light travels in a year is 5,865,690,000,000 miles/year 5,865,695,000,000 miles/year 58,656,950,000,000 miles/year 6,789,000,0000 miles/year
Answers: 1
question
Computers and Technology, 23.06.2019 12:20
When guido van rossum created python, he wanted to make a language that was more than other programming languages. a. code-based b. human-readable c. complex d. functional
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
The option enables you to modify a slide element in most presentation applications.
Answers: 2
You know the right answer?
Creating fair teams. public int mindifference(int numTeams, int[] abilities) { In this question you...
Questions
question
English, 22.06.2019 08:40