示例代码
mergeSort.h
// 2 路归并排序实现头文件
#ifndef MERGE_SORT_H
#define MERGE_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 进行归并排序
*/
Status MergeSort(SqList *list);
/*
前置条件:list 非空
操作结果:打印 list 中的记录
*/
Status Print(const SqList *list);
#endif // !MERGE_SORT_H
mergeSort.c
// 2 路归并排序实现源文件
#include "mergeSort.h"
#include <st