文章
75
粉丝
0
获赞
147
访问
8.7k
#include <bits/stdc++.h>
using namespace std;
typedef struct node{
int data;
node *left,*right;
}*Tree;
void Insert(node* &t,int val){
if(t == nullptr){
t = new node();
t->data = val;
t->left = nullptr;
t->right = nullptr;
}else{
if(t->data > val) Insert(t->left,val);
else if(t->data < val) Insert(t->right,val);
}
}
void Pre(Tree t){
if(t != nullptr){
cout << t->data << " ";
Pre(t->left);
Pre(t->right);
}
}
void In(Tree t){
if(t != nullptr){
In(t->left);
cout << t-&g...
登录后发布评论
暂无评论,来抢沙发