0
This part of the algorithm has the function of bridging the elements of a List<Integer>
(list of normal integers) using the Mergesort sorting algorithm. ERROR ON LINE 7
private static List intercalar(List<Integer> list, int l, int h, int r){
int i = l, j = h, /*marcador do topo*/t = 0;
List<Integer> topo = Arrays.asList();
while(i < h && j < r){ // O(n/2) =
if(list.get(i) < list.get(j)){
topo.add(t, list.get(i)); **ERRO AQUI**
i++;
} else {
topo.add(t, list.get(j));
j++;
}
t++;
}
//anexa o restante das cartas(as cartas q ficaram sozinhas)
while(i < h){
topo.add(t, list.get(i));
t++;
i++;
}
while(j < r){
topo.add(t, list.get(j));
t++;
j++;
}
for(i = l, t = 0 ; i < r ; i++, t++) {
list.set(i, topo.get(t));
}
return list;
}
Displays the following error :
java.util.Unsupportedoperationexception:null (in java.util.Abstractlist)
Amigo presented the following error : java.util.List is Abstract; cannot be instantiated.
– A. Fernando
I published an answer there tries to see if it solves your problem
– Dev
I listed the errors that appeared...
– A. Fernando