标签:
#include<iostream> using namespace std; #define SIZE 21 typedef int Sqlist[SIZE]; void InsretSort(Sqlist &L,int n) { for(int i=2;i<n;++i) { L[0] = L[i]; for(int j=i;L[0] < L[j-1];--j) { L[j] = L[j-1]; } L[j] = L[0]; } } void main() { Sqlist L= {0,49,38,65,97,76,13,27}; InsretSort(L,8);//直接插入 for(int i=1;i<8;++i) cout<<L[i]<<" "; cout<<endl; }
标签:
原文地址:http://blog.csdn.net/zr1076311296/article/details/46546563