void fun(int Array[], int L, int R)
{
if (L >= R)
return;
int temp = Array[L];
int tempL = L;
int tempR = R;
while (tempL < tempR)
{
while (tempL < tempR&&temp < Array[tempR])
{
tempR--;
}
int tempdata = Array[tempR];
Array[tempR] = Array[tempL];
Array[tempL] = tempdata;
while (tempL < tempR&&temp >= Array[tempL])
{
tempL++;
}
tempdata = Array[tempR];
Array[tempR] = Array[tempL];
Array[tempL] = tempdata;
}
fun(Array, L, tempL - 1);
fun(Array, tempL + 1, R);
}
快速排序
最新推荐文章于 2021-02-18 20:16:28 发布