C语言版数据结构 希尔排序.pdfVIP

  • 6
  • 0
  • 约1.48千字
  • 约 2页
  • 2021-11-14 发布于江苏
  • 举报
2. 希尔排序 详细设计 #include stdio.h #include stdlib.h #include time.h typedef int KeyType; typedef int OtherType; #define Max_Size 5000 typedef struct { KeyType key; OtherType other_data; }RecordType; void ShellInsert(RecordType r[], int length, int delta) /*对记录数组r 做一趟希尔插入排序,length 为数组的长度,delt 为增量*/ { int i,j; for(i=1+delta;i=length;i=i+delta) //1+delt 为第一个子序列的第二个元素的下标 if(r[i].keyr[i-delta].key) { RecordType t; t=r[i]; //备份r[i] for(j=i;j0 t.keyr[j-delta].key;j-=delta)

文档评论(0)

1亿VIP精品文档

相关文档