//插入排序 class InsertSort{ public void sort(int[] a){ int i,j,temp; for (i = 1; i < a.length; i++) { if (a[i] < a[i-1]){ temp = a[i]; for ( j = i-1; j >=0 && a[j] > temp; j--) { a[j+1] = a[j]; } a[j+1] = temp; } } } }
标签:sort,temp,int,插入排序,++,class From: https://www.cnblogs.com/jixian/p/17154923.html