Click to view operation. |
Integer Array
public static int[] insertionsort(int[] input){
for(int i=1; i= 0 && input[j] > value){
input[j+1] = input[j];
j--;
}
input[j+1] = value;
}
return input;
}
Object Array
public static > T[] insertionsort(T[] input){
for(int i=1; i= 0 && input[j].compareTo(value)>0){
input[j+1] = input[j];
j--;
}
input[j+1] = value;
}
return input;
}
No comments:
Post a Comment