示例代码

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 

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部