文章

10

粉丝

55

获赞

3

访问

2.8k

头像
二叉排序树 - 华科 题解:边遍历边输出
P1396 华中科技大学
发布于2024年3月15日 08:27
阅读数 280

#include <bits/stdc++.h>
using namespace std;

typedef struct node{
    int data;
    struct node *rchild,*lchild;
}*BitTree;

int tmp=-1;

void Insert(BitTree &T,int x){
    if(T==NULL){
        T=new node;
        T->data=x;
        T->rchild=NULL;
        T->lchild=NULL;
        cout<<tmp<<endl;
        tmp=-1;
        return;
    }
    else if(T->data==x) return;
    else if(T->data>x){
        tmp=T->data;
        Insert(T->lchild,x); 
    }
    else {
        tmp=T->data;
   ...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发