//繁琐版快速排序
#include
#define MAXSIZE 1000
using namespace std;
typedef struct
{
int key;
char *otherinfo;
}ElemType;
typedef struct
{
ElemType *r;
int length;
}SqList;
int Partition(SqList &L,int low,int high)//一趟划分
{
int pivotkey;
L.r[0]=L.r[low]; //以pivotkey为基准
pivotkey=L.r[low].key;
while(low= pivotkey &&low=和<=
L.r[high]=L.r[low];
}
L.r[low]=L.r[0];
return low;
}
void QSort(SqList &L,int low,int high)
{
int pivotloc;
if(low>n; //输入的值不大于 MAXSIZE
for(i=1;i<=n;i++)
{
cin>>L.r[i].key;
L.length++;
}
}
void show(SqList L)
{
int i;
for(i=1;i<=L.length;i++)
if(i==1)
cout<
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)