class SelectionSort
{
public static void main(String[] args)
{
//System.out.println("Hello World!");
int[] arr = {14,19,11,109,56,3};
selectionSort(arr);
for(int x=0;x<arr.length;x++)
{
System.out.print(arr[x]+",");
}
}
/*
选择排序
*/
public static void selectionSort(int[] arr)
{
for(int x=0;x<arr.length-1;x++)
{
for (int y=x+1;y<arr.length ;y++ )
{
if(arr[x]>arr[y])
{
//把最小的数,排序到前面
int temp = arr[x];
arr[x] = arr[y];
arr[y] = temp;
}
}
}
}
}