冒泡排序:
for (int i = 0; i < arr.length-1; i++) { for (int j =0;j<arr.length-1-i;j++) { if (arr[j] > arr[j + 1]) { tmp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = tmp; } } }
快速排序:
(i = i < arr.-i++) { (j = i + j < arr.j++) { (arr[i]>arr[j]) { tmp = arr[i]arr[i] = arr[j]arr[j] = tmp} }}