#include "stdafx.h"
#include <iostream>
using namespace std;
void print(int data[], int n)
{
for (int i = 0; i < n; i++)
{
cout << data[i] << " ";
}
cout << endl;
}
void quick_ascending_sort(int data[], int len, int low, int high)
{
int i = 0, j = 0, temp = 0, d = 0;
if (low >= high)
{
return;
}
temp = data[low];
i = low;
j = high;
while (i < j)
{
/*比temp小的元素移到低端*/
while (i < j && data[j] >= temp)//
j--;
if (i < j)
data[i++] = data[j];
/*比temp大的元素移到高端*/
while (i < j && data[i] <= temp)
i++;
i
数据结构中的排序--快速排序
最新推荐文章于 2023-04-06 23:40:29 发布