示例代码
shellSort.h
// // 希尔排序实现头文件
#ifndef SHELL_SORT_H
#define SHELL_SORT_H
#include "errorRecord.h"
#define NUM 10
#define MAX_SIZE 20
#define EQUAL(a, b) ((a) == (b))
#define LESS_THAN(a, b) ((a) < (b))
#define LESS_OR_EQUAL(a, b) ((a) <= (b))
typedef int InfoType;
typedef int KeyType;
typedef struct {
KeyType key;
InfoType info;
} RecType;
typedef struct {
RecType rec[MAX_SIZE + 1]; // 0 位置用作哨兵或闲置
int length;
} SqList;
// 希尔排序实现源文件
#include "shellSort.h"
/*
前置条件:list 非空
操作结果:打印列表
*/
Status Print(SqList *list);
/*
算法 10.5
前置条件:list 非空
操作结果:按增量序列 step[0 .. t - 1] 对顺序表 list 作希尔排序
*/
Status ShellSort(int n, int step[], SqList *list);
订阅专栏 解锁全文
2558

被折叠的 条评论
为什么被折叠?



