#include<stdio.h>
#define VirNode '0'
#define MAX_TREE_SIZE 100
typedef char ElemType;
typedef ElemType SqBitTree[MAX_TREE_SIZE];
void leveltree(SqBitTree bt)
{
int i;
int j;
i=1;
while(i<=bt[0])
{
for(j=i;j<2*i;j++)
if(bt[j]==VirNode)
{
printf("*");
}else
{
printf("%c",bt[j]);
}
printf("\n");
i=2*i;
}
}
void CreateBiTree(SqBitTree bt,int n)
{
int i,j,m;
i=1;
m=0;
while(m<n)
{
for(j=i;j<2*i;j++)
{
scanf("%c",bt+j);
if(bt[j]!=VirNode)
{
m++;
}
}
i=2*i;
}
bt[0]=i-1;
}
int TreeDepth(TreeNode* mRoot)
{
int n;
n.push(mRoot);
if(mRoot==NULL)
return 0;
TreeNode* m;
int depth = 0;
int count = 0;
int nextcount = 1;
while(!n.empty())
{
count++;
m = n.front();
n.pop();
if(m->left!=NULL)
{
n.push(m->left);
}
if(m->right!=NULL)
{
n.push(m->right);
}
if(count==nextcount)
{
depth++;
count=0;
nextcount=n.size();
}
}
return depth;
}
错误提示
根据错误提示,你的代码中有全角字符,应该是某个结束符
这个是错误提示
您的问题已经有小伙伴解答了,请点击【采纳】按钮,采纳帮您提供解决思路的答案,给回答的人一些鼓励哦~~
ps:开通问答VIP,享受5次/月 有问必答服务,了解详情↓↓↓
【电脑端】戳>>> https://vip.csdn.net/askvip?utm_source=1146287632
【APP 】 戳>>> https://mall.csdn.net/item/52471?utm_source=1146287632
treenode的结构体定义怎么都没有,n.push那里说明n要构造成一个栈啊