Text: Data Structures
9. Rewrite the following Java code for Insertion Sort so that it will sort any Object that implements the Comparable interface:
public static int[] insertionSort(int array[]) {
int[] n = array;
int in, out, temp;
for(out = 1; out < n.length; out++) {
temp = n[out];
in = out;
while(in > 0 && n[in-1] >= temp) {
n[in] = n[in-1];
in--;
}
n[in] = temp;
}
return n;
}