插入排序

void InsertingSort(int *p,int length){
    if(p==NULL) return ;
    for(int i=1;i<length;i++){
        int j=i-1;
        int key=p[i];
        while(j>=0&&p[j]>key) p[j+1] = p[j--];
        p[j+1] = key;
    }
}
文章导航