如何理解快速排序算法的思想?

poplars 1年前 已收到1个回答 举报

lxf0726 花朵

共回答了20个问题采纳率:95% 举报

#include
using std::cout;
using std::endl;
int Partition( int *R, int low, int high){
// 对记录子序列 R[low..high] 进行一趟快速排序,并返回枢轴记录
// 所在位置,使得在它之前的记录的关键字均不大于它的关键字,
// 而在它之后的记录的关键字均不小于它的关键字
R[0] = R[low]; // 将枢轴记录移至数组的闲置分量
int pivotkey = R[low]; // 枢轴记录关键字
cout

1年前

1
可能相似的问题
Copyright © 2024 YULUCN.COM - 雨露学习互助 - 17 q. 0.024 s. - webmaster@yulucn.com