#include<bits/stdc++.h>
using namespace std;
typedef struct Node{
int data;
struct Node* Left;
struct Node* Right;
}BiTree;
void CreatBiTree(BiTree *bt){
int num;
cin>>num;
if(num==0) bt=NULL;
if(num!=0){
bt=new BiTree;
bt->data=num;
CreatBiTree(bt->Left);
CreatBiTree(bt->Right);
}
}
int main(){
BiTree* root;
CreatBiTree(root);
cout<<root->data;
}
这种扩展先序遍历为什么不能建立二叉树,没有输出结果
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
1条回答 默认 最新
真相重于对错 2021-11-16 16:37关注create(bitree *) 改成create(Bitree* & )本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报 编辑记录