关于排序算法
看到数据结构与算法分析C++版第二版上shell的C++实现源码,想了很久才想通,现在将思路注释如下://这是shell排序算法中调用的函数,incr为间隔,A[]为起始地址//函数的目的是对间隔为incr的小组进行插入排序void inssort2(Elem A[],int n,int incr) { for(int i=incr;i for(int j=i;(j>=incr)&&(Comp::lt(A[j],A[j-incr]));j-=incr) swap(A,j,j-incr);}//shel
复制链接