-->
当前位置:首页 > Eng

函数题:快速排序

Luz3年前 (2022-11-28)Eng888
给一个无序表,使用快速排序算法对它进行排序。

### 函数接口定义:
c++
void partition(SeqList *L,int low,int high,int *cutpoint);
void quickSort(SeqList *L, int low, int high);


其中L是待排序表,low和high是排序的区间。

### 裁判测试程序样例:
c++
#include <stdio.h>

#define MAXLEN 50
typedef int KeyType;

typedef struct
{ KeyType key;
} elementType;

typedef struct
{ elementType data[MAXLEN+1];
int len;
} SeqList;

void creat(SeqList *L)
{ int i;
scanf("%d",&L->len);
for(i=1;i<=L->len;i++)
scanf("%d",&L->data[i].key);
}

void print(SeqList L) /*细节在此不表*/

void partition(SeqList *L,int low,int high,int *cutpoint);
void quickSort(SeqList *L, int low, int high);

int main ()
{ SeqList L; int low,high;
creat(&L);
low=1; high=L.len;
quickSort(&L,low,high);
print(L);
return 0;
}

/* 请在这里填写答案 */


### 输入样例:
in
5
3 1 9 5 7


### 输出样例:
out
1 3 5 7 9






answer:若无答案欢迎评论