数据结构排序算法大总结c++.docxVIP

  • 2
  • 0
  • 约6.34千字
  • 约 8页
  • 2021-01-29 发布于天津
  • 举报
#define CPP C++ // #define MPP M++ // #define MP2 M+=2 #define MP3 M+=3  比较 移动 #includeiostream.h #include string.h #includestdlib.h #include iomanip.h #include math.h #includetime.h 存储结构(数组) const int maxsize=1000; // 排序表容量,假设为 100.. typedef int datatype; // 假设存储元素是整形类型 typedef struct { datatype key; // 关键字域 }rectype; // 记录类型 typedef rectype list[maxsize+1]; // 排序表类型, 0 号单元不用; __int64 C,M; // 比较和移动次数 void checkup(list R,int n) { // 检验升序排序结果 int i; for(i=2;i=n;i++) if(R[i].keyR[i-1].key) {coutError!\n;return;} coutCorrect! endl; } void checkdown(list R,int n) { // 检验降序排序结果 int i; for(i=2

文档评论(0)

1亿VIP精品文档

相关文档