我也不知道老师为什么要这么封装
函数接口定义
int Partition(SqList& L, int low, int high);
void QSort(SqList& L, int low, int high);
void QuickSort(SqList& L);
判断测试程序
#include <stdio.h>
#include <stdlib.h>
#define MAXSIZE 20
typedef int KeyType;
typedef int KeyType;
typedef struct {
KeyType key;
}RedType;
typedef struct {
RedType R[MAXSIZE + 1];
int length;
}SqList;
int Partition(SqList& L, int low, int high);
void QSort(SqList& L, int low, int high);
void QuickSort(SqList& L);
int main()
{
SqList L;
scanf("%d", &L.length);
for (int i = 1; i <= L.length; ++i)
scanf("%d", &L.R[i].key);
QuickSort(L);
for (int i = 1; i <= L.length; ++i)
printf("%d ",L.R[i].key);
}
/*下面插入接口实现代码*/
按照我的理解写的
此处内容需要评论回复后(审核通过)方可阅读。
2 条评论
滴!学生卡!打卡时间:上午8:21:44,请上车的乘客系好安全带~
OωO