(五十七)第 9 章 查找(动态查找表(二叉排序树))
示例代码
bST.h
// 动态查找表(二叉排序树)的基本操作实现头文件#ifndef BST_H
#define BST_H#include "errorRecord.h"#define EQUAL(a, b) ((a) == (b))
#define LESS_THAN(a, b) ((a) < (b))
#define LESS_OR_EQUAL(a, b) ((a) <= (b))#define N 10typedef int KeyType;typedef struct {KeyType key;int others;
} ElemType, TElemType;typedef struct BSTNode {TElemType data;struct BSTNode *lChild;struct BSTNode *rChild;
} BSTNode, *BSTree;// 动态查找表(二叉排序树)的基本操作实现源文件#include "bST.h"
#include <stdlib.h>/*前置条件:searchTable 非空操作结果:构造一个空的动态查找表 searchTable
*/
Status InitDSTable(BSTree *searchTable);/*前置条件:searchTable