How do I make a sort method using recursion?
问题 I'm learning recursion and I was instructed to make a recursive method that sorts an array. So far I have this: public static void sort(int [] a, int i) { if(i == a.length - 1){ System.out.println(a[i]); } if(i < a.length) { if(a[i] > a[i+1]) { int temp = a[i+1]; a[i+1] = a[i]; a[i] = temp; sort(a,i++); } printArray(a); } } Now I know this is wrong because I still really don't quite understand how to use recursion in my programming. If someone could just help me with the method I would