冒泡排序
public void bubbleSort(int[] s){
int n = s.length;
for (int i = 0;i<n;i++)
for (int j = 1;j<n-i;j++){
if (s[j-1]>s[j]){
int temp = s[j-1];
s[j-1] = s[j];
s[j] = temp;
}
}
}
快速排序
public void quickSort(int[] s, int l, int r) {
if (l < r) {
int i = l, j = r;
int x = s[i];
while (i < j) {
while (i < j && s[j] >= x)
j--;
if (i < j) {
s[i++] = s[j];
}
while (i < j && s[i] < x)
i++;
if (i < j) {
s[j--] = s[i];
}
}
s[i] = x;
quickSort(s, l, i - 1);
quickSort(s, i + 1, r);
}
}