public class InsertionSortRecursion {
public static void main(String[] args) {
int[] data = {5, 2, 4,6,9,0, 3};
recursion(data, 0, data.length - 1);
for (int i = 0; i < data.length; i++) {
System.out.print(data[i] + " ");
}
}
public static void recursion(int[] data, int i, int j) {
if (i < j) {
int q = j - 1;
recursion(data, i, q);
for (int a = 0; a < j; a++) {
int key = data[j];
if (data[a] < key) {
for (int b = j - 1; b >= a; b--) {
data[b + 1] = data[b];
}
data[a] = key;
break;
}
}
}
}
}