清华大学课程的讲义数阵据结构01.pptVIP

  • 0
  • 0
  • 约6.5千字
  • 约 57页
  • 2021-12-03 发布于福建
  • 举报
dataList类中所有操作作为模板函数的实现 #ifndef SELECTTM_H #define SELECTTM_H #include “datalist.h” template class Type void dataList Type:: Swap (const int m1, const int m2) { //交换由m1, m2为下标的两个数组元素的值 Type temp = Element [m1]; Element [m1] = Element [m2]; Element [m2] = temp; } template class Type int dataListType:: MaxKey (const int low, const int high) { //查找数组Element[low]~Element[high]中的 //最大值,函数返回其位置 int max = low; for (int k = low+1, k = high, k++) if ( Element[max] Element[k] ) max = k; return max; } template class Type ostr

文档评论(0)

1亿VIP精品文档

相关文档