到底什么是前端二叉树的遍历

如题所述

二叉树遍历代码
#include"iostream.h"
#include"stdlib.h"
#include"stdio.h"
#include<stack>
using namespace std;
#define NULL 0
#define OK 1
#define OVERFLOW -1
typedef int Status;
typedef struct node
{
char data;
struct node *lchild;
struct node *rchild;
}*bitree;
int k=0;
int depth(bitree T)//树的高度
{
if(!T)return 0;
else
{
int m=depth(T->lchild); int n=depth(T->rchild); return (m>n?m:n)+1;
}
}
//先序,中序 建树
struct node *create(char *pre,char *ord,int n) {
struct node * T;
int m;
T=NULL;
if(n<=0)
{
return NULL;
}
else
{
温馨提示:答案为网友推荐,仅供参考
相似回答