二叉树层次遍历非递归算法!出问题了!
typedef struct group //定义队列节点结构
{
bitree shuju;
struct group *next;
}group, *grouptr;
typedef struct //定义队列指针
{
grouptr front;
grouptr rear;
}linkgroup;
void Levelorder(bitree Tree) //层次遍历
{
linkgroup gr;
bitree p;
initialize(gr);
p=Tree;
Pushgroup(gr,p);
while(Emptygroup(gr)!=1)
{
Popgroup(gr,p);
if(p->lchild!=NULL)
Pushgroup(gr,p->lchild);
if(p->rchild!=NULL)
Pushgroup(gr,p->rchild);
}
}
编译运行出错,红色部分。错误:type 'tree' does not have an overloaded member 'operator ->'和left of '->lchild' must point to class/struct/union两种错误!
求大神给指点迷津!
{
bitree shuju;
struct group *next;
}group, *grouptr;
typedef struct //定义队列指针
{
grouptr front;
grouptr rear;
}linkgroup;
void Levelorder(bitree Tree) //层次遍历
{
linkgroup gr;
bitree p;
initialize(gr);
p=Tree;
Pushgroup(gr,p);
while(Emptygroup(gr)!=1)
{
Popgroup(gr,p);
if(p->lchild!=NULL)
Pushgroup(gr,p->lchild);
if(p->rchild!=NULL)
Pushgroup(gr,p->rchild);
}
}
编译运行出错,红色部分。错误:type 'tree' does not have an overloaded member 'operator ->'和left of '->lchild' must point to class/struct/union两种错误!
求大神给指点迷津!

...全文
相关推荐
二叉树先序、中序、后序遍历非递归算法
### 二叉树先序、中序、后序遍历非递归算法#### 前言在计算机科学中,二叉树是一种常见的数据结构,它被广泛应用于各种算法和程序设计中。
二叉树前序、中序、后序三种遍历的非递归算法(C语言)
### 总结以上介绍了二叉树前序、中序和后序遍历的非递归实现。通过使用栈,这些算法避免了递归带来的潜在问题,如栈溢出,同时保持了良好的空间和时间效率。
二叉树先序遍历、中序遍历和后序遍历非递归算法 C++源码
用C++写的二叉树先序遍历、中序遍历和后序遍历非递归算法
二叉树前序遍历的非递归算法
"二叉树前序遍历的非递归算法"二叉树前序遍历的非递归算法是指在不使用递归函数的情况下,对二叉树进行前序遍历的算法。前序遍历是指先访问根节点,然后访问左子树,最后访问右子树。
中序遍历二叉树非递归算法
实践应用与优化在实际编程中,中序遍历非递归算法不仅适用于二叉树的遍历,还常用于解决二叉树相关的更复杂问题,如平衡因子的计算、二叉树的镜像翻转等。


