构造平衡二叉排序树
程序如下:
#include"stdio.h"
#include"stdlib.h"
typedef int KeyType;
typedef struct node
{KeyType key;
struct node *lchild,*rchild;
}BSTNode;
typedef BSTNode *BSTree;
BSTree CreateBST(void);
void DelBSTNode(BSTree *Tptr,KeyType Key);
void InorderBST(BSTree T);
void InsertBST(BSTree *bst,KeyType key);
main()
{BSTree T;
char ch1,ch2;
KeyType Key;
printf("建立一棵二叉排序树的二叉链表存储");
T=CreateBST();
ch1='y';
while (ch1=='y'||ch1=='Y')
{printf("请选择下列操作:");
printf("1------更新二叉树上的存储");
printf("2------二叉排序树上的删除");
printf("3------二叉排序树中序输出");
printf("4------退出");
scanf("%c",&ch2);