数据结构与算法 作者 王曙燕 chapter9 排序.pptVIP

  • 27
  • 0
  • 约1.12万字
  • 约 59页
  • 2015-12-10 发布于广东
  • 举报

数据结构与算法 作者 王曙燕 chapter9 排序.ppt

* 9.3 交换类排序 ②快速排序 int QKpass (RecordType r[ ], int low, int high) { } r[0] = r[low]; while (lowhigh) { } while(lowhigh r[high].key= r[0].key) -- high; r[low] = r[high]; while (lowhigh r[low].key= r[0].key) ++ low; r[high] = r[low]; r[low] = r[0]; return low; 一趟快速排序算法 * void QKSort(RecordType r[ ],int low,int high) { r[0]=r[low]; if(lowhigh) { pos=QKpass(r,low,high); QKSort(r,low,pos-1); QkSort(r,pos+1,high); } 9.3 交换类排序 ②快速排序 算法 * 9.3 交换类排序 ②快速排序 时间性能 假设一次划分所得枢轴位置 i=k,则对n 个记录进 行快排所需时间:  其中 Tpass(n)为对

文档评论(0)

1亿VIP精品文档

相关文档