文章

71

粉丝

97

获赞

5

访问

18.3k

头像
二叉排序树 - 华科 题解:
P1396 华中科技大学
发布于2024年2月1日 21:48
阅读数 301

#include<iostream>
#include<string>
using namespace std;
int m = -1;
typedef struct Tnode {
    int data;
    struct Tnode* lchild, * rchild;
}Tnode, * Tree;

void Insert(Tree &T,int x,Tree &p) {
    if (T == NULL) {
        if (p == NULL) {
            cout <<m << endl;
        }
        else
            cout << p->data << endl;
        T = new Tnode;
        T->data = x;
        T->lchild = NULL;
        T->rchild = NULL;
        return;
    }
    if (T->data == x) return;
    else if (x ...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发