English, asked by saitejailu, 12 days ago

A computing cluster has multiple processors, each with 4 cores

Answers

Answered by Jasleen0599
0

A computing cluster has multiple processors, each with 4 cores

int processorTime[n]: each processorTime[i] denotes the time at which all 4 cores of the ith processor become available

int taskTime[4*n]: each taskTime[i] denotes the execution time of the ith task Returns

int: the earliest time at which all the tasks can be finished.

public static int minTime(List<Integer> processorTime, List<Integer> taskTime) {

Collections.sort(processorTime);

Collections.sort(taskTime);

Collections.reverse(taskTime);

int result = 0;

int curTask = 0;

for(int proctime : processorTime){

   for(int i=0; i<4 ; ++i){

       int completionTime = taskTime.get(curTask) + proctime;

       curTask++;

       result = result > completionTime ? result : completionTime;

   }

}

return result;

#SPJ2

Similar questions