示例代码
qSort.h
// 快速排序实现头文件
#ifndef Q_SORT_H
#define Q_SORT_H
#include "errorRecord.h"
#define MAX_SIZE 20
#define NUM 8
typedef int KeyType;
typedef int InfoType;
typedef struct {
KeyType key;
InfoType otherInfo;
} RecType;
typedef struct {
RecType rec[MAX_SIZE + 1]; // rec[0] 用作哨兵或闲置
int length;
} SqList;
/*
前置条件:list 非空
操作结果:对顺序表 list 中的子序列 list.rec[low..high] 作快速排序
*/
Status QuickSort(SqList *list);
Status Print(const SqList *list);
#endif // !Q_SORT_H
qSort.c
// 快速排序实现源文件
#include "qSort.h"
static void Swap(int
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » (六十七)第 10 章 内部排序(快速排序)
发表评论 取消回复