选择排序的基本思想是从序列中选出最小值,将它放在前面第0位置:然后在剩下的数中选择最小值,将它
10 查阅
选择排序的基本思想是从序列中选出最小值,将它放在前面第0位置:然后在剩下的数中选择最小值,将它放在前面第 1位置,依此类推。请在程序的每条横线处填写一条语句,使程序的功能完整。
注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。
public class SelectSort{
public static void main(String args [ ]){
int i,j;
int a[ ]={30,1,-9,70,25}
int size=a.length;
for(i=0;_____________________i++)
for (j=i+1;_______________j++)
if(a[i]>a[j])
{
int temp=a[i];
______________
a[j]=temp;
}
for(i=0;i<size;i++)
System.out.println(a[i]+ "" );
}
}
参考答案: