A computing cluster has multiple processors, each with 4 cores
Answers
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