示例代码
treeSelectSort.h
// 树形选择排序实现头文件
#ifndef TREE_SELECT_SORT_H
#define TREE_SELECT_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 TreeSelectSort(SqList *list);
/*
前置条件:list 非空
操作结果:打印 list 中的记录
*/
Status Print(const SqList *list);
#endif // !TREE_SELECT_SORT_H
treeSelectSort.c