First establish the input data into a binary sort tree, and then find the data. Enter the keyword sequence (63, 90, 70, 55, 67, 42, 98, 83, 10, 45, 58). 1. Establish a binary sort tree according to the order of the entered keywords.

2022-02-02 14:25:17

What I want to achieve

``#include<stdio.h>#include<stdlib.h>#include<string.h>#include <malloc.h>#define error 0#define ok 1typedef struct BiTNode{    char data;    struct BiTNode *lchild,*rchild;}BiTNode,*BiTree;int CreateBiTree(BiTree T){    char ch;    fflush(stdin);    scanf("%c",&ch);        if(ch=='#'){        T=NULL;        return ok;    }else    {        if(!(T=(BiTNode *)malloc(sizeof(BiTNode))))        exit(error);        T->data=ch;        CreateBiTree(T->lchild);        CreateBiTree(T->rchild);    }    return ok;}void PreOrderBiTree(BiTree T){    if(T)    {        printf("%c",T->data);        PreOrderBiTree(T->lchild);        PreOrderBiTree(T->rchild);    }}void InOrderBiTree(BiTree T){    if(T)    {        InOrderBiTree(T->lchild); // The middle order traverses the left subtree         printf("%c",T->data); // access node         InOrderBiTree(T->rchild); // The middle order traverses the right subtree     }}void PostOrderBiTree(BiTree T){    if(T)    {        PostOrderBiTree(T->lchild);        PostOrderBiTree(T->rchild);        printf("%c",T->data);    }}main(){    int i;    BiTree T = NULL;    printf("\t Please enter each element of the tree ：\n\t");    CreateBiTree(T);    printf("aaaaaaaaaaa");    do    {        printf(" /*****************************/\n");        printf("\t1 key ： Sequential output ; \n\t2 key ： Middle order output ;\n\t3 key ： Sequential output ！\n\t0 key ： Exit procedure ！\n");        printf("\t Please enter your choice ：\n\t");        scanf("%d",&i);        switch(i)        {            case 1:printf("\n\t What you choose is sequential output ！！ \n");            printf("\n\t The output is ：\n");            printf("\t");            PreOrderBiTree(T);break;            case 2:printf("\n\t You choose medium order output ！！ \n");            printf("\n\t The output is ：\n");            printf("\t");            InOrderBiTree(T);break;            case 3:printf("\n\t What you choose is sequential output ！！ \n");            printf("\n\t The output is ：\n");            printf("\t");            PostOrderBiTree(T);break;        }        printf("\n");    }while(i!=0);    return 0;}``