本文最后更新于 2024-10-06,距文章上次修改已超2个月之久……请注意内容的时效性~~

插入排序

int main
{
    int n = 10 , a={0,15,28,37,31,21,49,9,7,19,10};
    
    forinti=2;i<=n;i++int i = 2 ; i <= n ; i ++inti=2;i<=n;i++
    {
        int x = aiii;
        int j = i - 1;
        while(j > 0 && x < a[j])
        {
            aj+1j + 1j+1 = ajjj;
            j --;
        }
        aj+1j + 1j+1 = x;
    }
    
    forinti=1;i<=n;i++int i = 1 ;  i <= n ; i ++inti=1;i<=n;i++
    {
        cout << aiii << ' ';
    }
    return 0;
}