public class Sort
{
//交换排序之最简单的冒泡排序法
public static void BubbleSort(int[] a)
{
int ijtemp;
int n = alength;
for(i=;i<n;i++)
{
for(j=i+;j<n;j++)
{
if (a[i]>a[j])
{
temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
}
//插入排序 直接插入排序
public static void InsertSort(int[] a)
{
int ijtemp;
int n = alength;
for(i=;i<n;i++)
{
temp = a[i];
j=i;
while((a[j]>temp)&&(j>=))
{
a[j+] = a[j];
j;
}
a[j+] = temp;
}
}
//选择排序
public static void SelectSort(int[] a)
{
int ijmintemp;
int n=alength;
for(i=;i<n;i++)
{
min = a[i];
for(j=i+;j<n;j++)
{
if(a[j]<min)
{
temp = min;
min =a[j];
a[j] = temp;
}
}
a[i] =min ;
}
}
public static void main(String[] args)
{
int[] arr = {};
int n = arrlength;
BubbleSort(arr)
for(int i=;i<n;i++)
Systemoutprint(arr[i]+ )
Systemoutprintln()
InsertSort(arr)
for(int i=;i<n;i++)
Systemoutprint(arr[i]+ )
Systemoutprintln()
SelectSort(arr)
for(int i=;i<n;i++)
Systemoutprint(arr[i]+ )
}
}