#include<stdio.h>
#include<stdlib.h>
#define MAXSIZE 100
//二叉树的结点
typedef struct Node
{
char data;
struct Node * LChild;
struct Node * RChild;
}LinkBTree, * PLinkBTree;
//入栈的元素
typedef struct elementype
{
PLinkBTree node;
int flag;
}elementype;
//顺序栈
typedef struct
{
int top; //指向栈顶,初始为-1
elementype data[MAXSIZE]; //存储指向某个二叉树结点的指针
}SeqStack, * PSeqStack;
void PostTraverse1(PLinkBTree); //非递归后序遍历链式二叉树
void PostTraverse2(PLinkBTree); //递归后序遍历链式二叉树
PLinkBTree PreCreateLBT(void); //递归先序构造链式二叉树
void Init_SeqStack(PSeqStack); //初始化顺序栈
bool Push_SeqStack(PSeqStack, elementype); //压栈
bool Pop_SeqStack(PSeqStack, elementype *); //出栈
bool Is_Empty(PSeqStack); //判断栈空
void visit(PLinkBTree); //遍历具体操作
bool Is_Full(PSeqStack); //判断栈满
int main(void)
{
PLinkBTree plb = NULL;
plb = PreCreateLBT();
printf("非递归后序遍历结果:\n");
PostTraverse1(plb);
printf("\n");
pri
04-16
351
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交