See More

package sort; //¼òµ¥Ñ¡ÔñÅÅÐò public class SelectSortTest { public static void main(String[] args) { SelectSort s = new SelectSort(); int[] array ={9,1,5,8,3,7,4,6,2}; s.selectSort(array); s.display(array); } } class SelectSort { public void selectSort(int[] a) { for(int i=0; ia[j]) //Èç¹ûÓÐСÓÚµ±Ç°×îСֵµÄ¹Ø¼ü×Ö { min = j; //½«´Ë¹Ø¼ü×Öϱ긳¸ømin } } if(i != min) //Èç¹ûmin²»µÈÓÚi£¬ËµÃ÷ÕÒµ½×îСֵ£¬½»»» { int temp =a[i]; a[i] = a[min]; a[min] =temp; } } } public void display(int[] a) { for(int i =0; i