int main()
{
int a[10] = {7,2,5,1,6,9,4,8,0,3};
for(int i = 1; i < 10;++i)
{
int iKey = a[i];
int j = i - 1;
while(j >= 0 && a[j] > iKey)
{
a[j + 1] = a[j];
--j;
}
a[j +1] = iKey;
}
for(int j = 0; j < 10; ++j)
cout<<a[j]<<" ";
return 0;
}
2584
3548
1468

被折叠的 条评论
为什么被折叠?