package xxx;
public class Effervescency {
public static void main(String[] args){
int a[]={1,22,3,55,6,77,8,99};
int temp=0;
for(int i=0;i<a.length-1;i++){
for(int j=0;j<a.length-1;j++){
if(a[j]>a[j+1]){
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
for(int i=0;i<a.length;i++)
System.out.println(a[i]);
}
}
package xxx;
public class Insert {
public static void main (String[] args){
int a[]={99,8,77,66,5,33,22,11};
int temp=0;
for(int i=1;i
int j=i-1;
temp=a[i];
for(;j>=0&&temp
a[j+1]=a[j];
}
a[j+1]=temp;
}
for(int i=0;i
System.out.println(a[i]);
}
}
package xxx;
public class QuickSort {
static int a[]={1,22,3,55,66,7,88,9};
public static void main(String[] args){
quick(a);
for(int i=0;i
System.out.println(a[i]);
}
public static int getMiddle(int[] list, int low, int high) {
int tmp = list[low];
while (low < high) {
while (low < high && list[high] >= tmp) {
high--;
}
list[low] = list[high];
while (low < high && list[low] <= tmp) {
low++;
}
list[high] = list[low];
}
list[low] = tmp;
return low;
}
public static void _quickSort(int[] list, int low, int high) {
if (low < high) {
int middle = getMiddle(list, low, high);
_quickSort(list, low, middle - 1);
_quickSort(list, middle + 1, high);
}
}
public static void quick(int[] a2) {
if (a2.length > 0) {
_quickSort(a2, 0, a2.length - 1);
}
}
}