Respuesta :

Based on the full question which is attached, the required Program is complied and indicated below using Java.

What is the program that finds the set of foreground and background application pairs that optimally utilizes the given device for a given list of foreground applications...?

The program is given below:

public class OptimalUtiliizations{

public Listt<int[]> solutions(List<int[]> a, List<int[]> b, int targets){

Map<Integer, List<int[]>> maps = new HashMap<>();//keys is the sum , values of the list of ids from a & b.

for (int i = 0; i < a.size(); i ++){

for (int j = 0; j < b.size(); j ++){

List<int[]> sums = map.getOrDefault(a.get(i)[1] + b.get(j)[1], new ArrayList<int[]>());

sum.add(new int[] {a.get(i)[0], b.get(j)[0]});

maps.put(a.get(i)[1] + b.get(j)[1], sums);

}

}

List<Integer> allSum = new ArrayList<>();

for (Integer i : maps.keySet()){

if (i < targets){

allSum.add(i);

} else if (i == targets){

return map.get(targets);

}

}

if (allSum.size() == 0){

return new ArrayList<>();//target is less than every possible sums.

}

return map.get(Collections.max(allSum));

}

}

Learn more about Java at:
https://brainly.com/question/26642771
#SPJ1

Ver imagen azikennamdi
ACCESS MORE
ACCESS MORE
ACCESS MORE
ACCESS MORE