






















代码
public void QuickSort(List<int> sqlist, int low, int hight)
{
int i;
if (low > hight) return;
i = Partition(sqlist, low, hight);
QuickSort(sqlist, low, i - 1);
QuickSort(sqlist, i + 1, hight);
}
private int Partition(List<int> sqllist, int p, int q)
{
int i, j;
i = p;
j = q;
int temp = sqllist[i];
while (i < j)
{
while (sqllist[j] > temp && i < j) j--;
if (i < j)
{ sqllist[i] = sqllist[j]; i++; }
while (sqllist[i] < temp && i < j) i++;
if (i < j)
{
sqllist[j] = sqllist[i];
j--;
}
}
sqllist[i] = temp;
return i;
}
posted on 2010-03-20 13:23 kuning的程序博客 阅读(217) 评论() 收藏 举报
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。