linkedlist java instanciation code example
Example: fusion vecteur ordonner java
public static int[] fusion2 ( int[] tab1, int[]tab2 ){
int[] result= new int[tab1.length+tab2.length];
int index1=0;
int index2=0;
int i=0;
while (i<tab1.length+tab2.length && index1!=tab1.length && index2 != tab2.length){
if (tab1[index1]<=tab2[index2]){
result[i]=tab1[index1];
index1++;
}
else if(tab1[index1]>tab2[index2]){
result[i]=tab2[index2];
index2++;
}
i++;
}
while (index1 < tab1.length){
result[i]=tab1[index1];
i++;
index1++;
}
while (index2 < tab2.length){
result[i]=tab2[index2];
i++;
index2++;
}
return result;
}