实验五排序邻接表矩阵.pptVIP

  • 0
  • 0
  • 约6.26千字
  • 约 22页
  • 2023-07-03 发布于广东
  • 举报
实验五排序邻接表矩阵第一页,共二十二页,2022年,8月28日 希尔排序dataList.hMain.cpp第二页,共二十二页,2022年,8月28日 templateclass typevoid Shellsort(DataListtype List)int gap=List.CurrentSize/2;while(gap){Shellnsert(List,gap);gap=gap==2?1:(int)(gap/2);开始gap=List.CurrentSize/2Shellnsert(List,gap)Gap!=0Gap=1Gap=2结束Gap=gap/2NYYN这里也可以没有这个判断语句一次排序的过程第三页,共二十二页,2022年,8月28日 templateclass typevoid Shellnsert(DataListtype List,const int gap)for(int i=gap;iList.CurrentSize;i++){Elementtype temp=List.Vector[i];int j=i;while( j=gaptemp.Getkey()List.Vector[j-gap].Getkey() ){List.Vector[j]=List.Vector[j-gap];j-=gap;}List.Vector[j]=temp;从第gap处开始比

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档