示例代码
staticLinkList.h
// 静态链表的插入排序实现头文件
#ifndef STATIC_LINK_LIST_H
#define STATIC_LINK_LIST_H
#include "errorRecord.h"
#define SIZE 100
#define NUM 8
typedef int InfoType;
typedef int KeyType;
typedef struct {
KeyType key;
InfoType info;
} RecType;
typedef struct {
RecType rec;
int next;
} SLNode;
typedef struct {
SLNode rec[SIZE];
int length;
} SLinkList;
/*
前置条件:list 非空
操作结果:由数组 rec 建立 n 个元素的表插入排序的静态链表 list
*/
Status TableInsert(int n, RecType rec[], SLinkList *list);
/*
算法 10.3
前置条件:list 非空
操作结果:由数组 rec 建立 n 个元素的表插入排序的静态链表 list
*/
Status Arrange(SLinkList *list);
/*
前置条件:list 非空
操作结果:求得 adr[1..L.length],adr[i] 为静态链表 list 的第 i 个最小记录