Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In the school computer room a set of servers is responsible for processing all computing tasks, each one with its own time cost. In order

In the school computer room a set of servers is responsible for processing all computing tasks, each one with its own time cost. In order to balance the time load for each server, it is necessary to assign all tasks to make the dierence between the most loaded server and the least loaded server as small as possible. In other words it is necessary to minimize the expression tmaxtmin , where tmax (tmin) is the largest (smallest) sum of the running times of all tasks assigned to a server. Write the function: void balance (int nTask, int *times, int nServer); which Receives the number of tasks nTask, the array storing the time costs of all tasks times, and the number of servers nServer in the computer room. Assigns each task to a server such that the aforementioned cost function is minimized. The function has to print the computer identier (a number from 0 to nServer1) assigned to each task. For example if there are nTask=7 tasks, with time costs equal to times = {1,2,3,4,5,6,7}, and nServer = 3 servers, we can assign {2,7} to computer 0, {3,6} to computer 1, and {1,4,5} to computer 3, with a cost dierence of 109 = 1.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Knowledge Discovery In Databases

Authors: Animesh Adhikari, Jhimli Adhikari

1st Edition

3319132121, 9783319132129

More Books

Students also viewed these Databases questions

Question

2. Discuss various aspects of the training design process.

Answered: 1 week ago