#include<stdio.h>
#include<stdlib.h>
struct Tree* makeempty(struct Tree* t);//1
struct Tree* find(int x, struct Tree* t);//2
struct Tree* findmin(struct Tree* t);//3
struct Tree* findmax(struct Tree* t);//4
struct Tree* insert(int x, struct Tree* t);//5
struct Tree* Delete(int x, struct Tree* t);//6
void printtree(struct Tree* t);//中序打印 7
struct Tree
{
int element;
struct Tree* left;
struct Tree* right;
};
int main(void)
{
struct Tree* min;
struct Tree* max;
struct Tree* node;
struct Tree* root;
root = insert(6, NULL);
for (int i = 0; i < 6; i++)
{
insert(i, root);
}
printtree(root);
node = find(4, root);
printf("find node is:%d\n", node->element);
min = findmin(root);
printf("min is:%d\n", min->element);
max = findmax(root);
printf("max is:%d\n", max->element);
Delete(4, root);
printtree(root);
return 0;
}
#include<stdlib.h>
struct Tree* makeempty(struct Tree* t);//1
struct Tree* find(int x, struct Tree* t);//2
struct Tree* findmin(struct Tree* t);//3
struct Tree* findmax(struct Tree* t);//4
struct Tree* insert(int x, struct Tree* t);//5
struct Tree* Delete(int x, struct Tree* t);//6
void printtree(struct Tree* t);//中序打印 7
struct Tree
{
int element;
struct Tree* left;
struct Tree* right;
};
int main(void)
{
struct Tree* min;
struct Tree* max;
struct Tree* node;
struct Tree* root;
root = insert(6, NULL);
for (int i = 0; i < 6; i++)
{
insert(i, root);
}
printtree(root);
node = find(4, root);
printf("find node is:%d\n", node->element);
min = findmin(root);
printf("min is:%d\n", min->element);
max = findmax(root);
printf("max is:%d\n", max->element);
Delete(4, root);
printtree(root);
return 0;
}