【文件属性】:
文件名称:中序遍历二叉树非递归算法 栈实现代码
文件大小:3KB
文件格式:CPP
更新时间:2015-12-23 11:47:11
中序遍历 二叉树 非递归 栈实现代码
typedef char TElemType;
typedef int Status;
typedef char SElemType;
//二叉树的二叉链表存储表示
typedef struct BiTNode
{
TElemType data;
BiTNode *lchild, *rchild; //左右孩子指针
} BiTNode, *BiTree;
typedef struct
{
BiTree *base;
BiTree *top;
int stacksize; //当前已分配的存储空间
} SqStack;
Status InitStack(SqStack &S)
Status GetTop(SqStack &S, BiTree &e)
Status Push(SqStack &S, BiTree e)
Status Pop(SqStack &S,BiTree &e)
Status StackEmpty(SqStack S)
网友评论
- 不错,值得初学者学习!
- 还不错,能运行