package rendezesbeszurassal; public class RendezesBeszurassal { static void rendezesBeszurassalR(int[] t, int n) { if(n>0) { // eredeti: n>1 rendezesBeszurassal(t, n-1); int x = t[n-1]; // eredeti: t[n] int j = n-2; // eredeti: n-1 while(j>= 0 && t[j]>x) { t[j+1] = t[j]; j = j-1; } t[j+1] = x; } } static void kiir(int[] t) { for (int i = 0; i < t.length; i++) { System.out.print(t[i]+" "); } System.out.println(); } public static void main(String[] args) { int[] t = {35, 24, 83, 12, 7, 23}; rendezesBeszurassalR(t, t.length); kiir(t); } }