CursorBSt.h
//该程序是二分查找树的链表游标的实现方式
#ifndef _CursorBST_H
typedef int PtrToNode;
typedef PtrToNode SearchTree;
typedef PtrToNode Position;
void InitializeCursorSpace(void);
SearchTree MakeEmpty(SearchTree T);
Position Find(int X, SearchTree T);
Position FindMin(SearchTree T);
Position FindMax(SearchTree T);
SearchTree Insert(int X, SearchTree T);
SearchTree Delete(int X, SearchTree T);
#endif
CursorBST.c
//该程序是二分查找树的链表游标实现
#include <stdio.h>
#include <stdlib.h>
#include "CursorBST.h"
#define SpaceSize 15
static Position CursorAlloc(void);
static void CursorFree(Position P);
struct Node
{
int Element;
Position Left;
Position Right;
Position Next;
};
struct Node CursorSpace[SpaceSize];
int main()
{
InitializeCursorSpace();
SearchTree A;
int B = 1;
A = CursorAlloc();
CursorSpace[A].Element = 2;
A = Insert(B, A);
printf("%d\n", CursorSpace[CursorSpace[A].Left]