44#define max(a,b) ((a>b)? a:b)
71 void (*keyPrint) (
void*))
85 return 1 +
max(leftdepth, rightdepth);
93 int (*compkey) (
void*,
void*))
99 else if(compkey(
key,
tree->key) < 0)
107 int (*compkey) (
void *,
void *))
116 if(compkey(newnode->
key,
x->key) < 0)
130 else if( compkey(newnode->
key,
y->key) <0)
158 x->parent =
y->parent;
160 if(
y->parent ==
NULL)
164 if(
y ==
y->parent->left)
167 y->parent->right =
x;
178 y->parent =
node->parent;
179 y->left =
node->left;
180 node->left->parent =
y;
187 x->parent =
y->parent;
190 if(
y ==
y->parent->left)
193 y->parent->right =
x;
195 y->parent =
node->parent;
196 y->left =
node->left;
197 y->right =
node->right;
198 node->left->parent =
y;
199 node->right->parent =
y;
203 node->parent->left =
y;
205 node->parent->right =
y;
254 while(
y !=
NULL &&
x ==
y->right)
275 while(
y !=
NULL &&
x ==
y->left)
GLint GLint GLint GLint GLint x
GLint GLint GLint GLint GLint GLint y
void TreeNodeDeleteSingleNode(treeNode *node)
treeNode * TreeNodeMaximum(treeNode *node)
treeNode * TreeNodePredecessor(treeNode *node)
treeNode * TreeNodeMinimum(treeNode *node)
treeNode * TreeNodeFind(treeNode *tree, void *key, int(*compkey)(void *, void *))
treeNode * TreeNodeMake(void *key)
treeNode * TreeNodeSuccessor(treeNode *node)
treeNode * TreeNodeInsert(treeNode *root, treeNode *newnode, int(*compkey)(void *, void *))
void TreeNodeDeleteWholeTree(treeNode *node)
void TreeNodePrint(treeNode *node, void(*keyPrint)(void *))
int TreeNodeDepth(treeNode *root)