Menu

[solved]-Hacker Industries Number Employees Company Assigns Employee Numeric Evaluation Score Store Q39041496

Please solve this problem using C language

Hacker Industries has a number of employees. The company assigns each employee a numeric evaluation score and stores these scInput Format for Custom Testing Input from stdin will be processed as follows and passed to the function. The first line cont

#incl ude <assert.h 19 20 Complete the teamFormat ion funct ion below 21 22 + The funct i on is expected to return a LONG_

Hacker Industries has a number of employees. The company assigns each employee a numeric evaluation score and stores these scores in a list. A manager is assembling a team for a new project and selects a number of employees from the list to create a team. He selects the team members in the following way: 1. During each selection, the manager chooses the employee with the highest score among either the first m available employees or the last m available employees in the list. The manager then removes the selected employee from the list and adds them to the team. That employee’s score is stored to the team list. 2. If there are multiple employees with the same highest score among the first or last m available employees, the manager selects the employee whose score is at the lowest index in the list of scores. 3. If there are fewer than m available employees, then the manager picks the employee with the highest score from available employees. For example, consider a company with 5 employees, with score = [10, 20, 10, 15, 5] respectively. A team of two employees needs to be formed, and the value of m is given to be 1. During the first selection, choose between the leftmost m elements: [10] and the rightmost m elements: [5]. The employee with score 10 is added to the team (10>5), and removed from the list. This makes score = [20, 10, 15, 5]. During the second selection, employee with score 20 is added to the team (20 5), and removed from the list. This makes score = [10, 15, 51. Hence, the total sum of the selected employees’ scores is 10 + 20 = 30. Function Description Complete the function teamFormation in the editor below. The function must return the sum of the scores of all members selected for the team. teamFormation has the following parameter(s): score[score[0],..score[n-1]]: an array of scores for each employee. team: the number of team members required. m: the size of the array segments to select from. Constraints 1 <ns 105 1 s score[i] s 109 1 s team n 1smsn Input Format for Custom Testing Input from stdin will be processed as follows and passed to the function. The first line contains an integer n, the size of the array score. The next n lines each contain an element score[i] where 0 s i < n, denoting the score of each employee The next line contains the integer team, denoting the number of employees in the team to be formed. The next line contains the integer m, as described in the statement. #incl ude <assert.h 19 20 Complete the ‘teamFormat ion’ funct ion below 21 22 + The funct i on is expected to return a LONG_ INTEGER The function accepts fol lowing paramet ers: 23 24 + 1. INTEGER_ARRAY score 25 2. INTEGER team 26 + 3. INTEGER m 27 28 29 ong teamFormat ion(int score_count, int score, int team, int m) { 30 31 32 33 34 int main() Show transcribed image text Hacker Industries has a number of employees. The company assigns each employee a numeric evaluation score and stores these scores in a list. A manager is assembling a team for a new project and selects a number of employees from the list to create a team. He selects the team members in the following way: 1. During each selection, the manager chooses the employee with the highest score among either the first m available employees or the last m available employees in the list. The manager then removes the selected employee from the list and adds them to the team. That employee’s score is stored to the team list. 2. If there are multiple employees with the same highest score among the first or last m available employees, the manager selects the employee whose score is at the lowest index in the list of scores. 3. If there are fewer than m available employees, then the manager picks the employee with the highest score from available employees. For example, consider a company with 5 employees, with score = [10, 20, 10, 15, 5] respectively. A team of two employees needs to be formed, and the value of m is given to be 1. During the first selection, choose between the leftmost m elements: [10] and the rightmost m elements: [5]. The employee with score 10 is added to the team (10>5), and removed from the list. This makes score = [20, 10, 15, 5]. During the second selection, employee with score 20 is added to the team (20 5), and removed from the list. This makes score = [10, 15, 51. Hence, the total sum of the selected employees’ scores is 10 + 20 = 30. Function Description Complete the function teamFormation in the editor below. The function must return the sum of the scores of all members selected for the team. teamFormation has the following parameter(s): score[score[0],..score[n-1]]: an array of scores for each employee. team: the number of team members required. m: the size of the array segments to select from. Constraints 1

Expert Answer


Answer to Hacker Industries has a number of employees. The company assigns each employee a numeric evaluation score and stores the… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *