二叉树的建及遍历.docVIP

  • 2
  • 0
  • 约6.35万字
  • 约 9页
  • 2016-12-25 发布于河南
  • 举报
建立二叉树: 遍历: #include stdafx.h #includeiostream.h #includestdlib.h #includestdio.h #includestack 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 (mn?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 { m=0; T=new(struct node); T-data

文档评论(0)

1亿VIP精品文档

相关文档