int Partition(RecType R[]int lint h)
//一趟快速排序算法枢轴记录到位并返回其所在位置
{ int i=l; j=h; R[] = R[i]; x = R[i]key;
while(i<j)
{ while(i<j && R[j]key>=x) j;
if (i<j) R[i] = R[j];
while(i<j && R[i]key<=x) i++;
if (i<j) R[j] = R[i];
}//while
R[i]=R[];
return i;
}//Partition
[题目分析]以Kn为枢轴的一趟快速排序将上题算法改为以最后一个为枢轴先从前向后再从后向前
int Partition(RecType K[]int lint n)
{ //交换记录子序列K[ln]中的记录使枢轴记录到位并返回其所在位置
//此时在它之前(后)的记录均不大(小)于它
int i=l; j=n; K[] = K[j]; x = K[j]key;
while(i<j)
{ while(i<j && K[i]key<=x) i++;
if (i<j) K[j]=K[i];
while(i<j && K[j]key>=x) j;
if (i<j) K[i]=K[j];
}//while
K[i]=K[]; return i;
}//Partition
[] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []