2叉树 算子树深度的问题

来源:百度知道 编辑:UC知道 时间:2024/05/30 05:27:32
#include<iostream.h>
#include<stdlib.h>
#include<stdio.h>
int leafcount=0;
int max=0;
int count=0;
typedef struct Node
{
char data;
struct Node *lchild;
struct Node *rchild;
}bitnode,*bitree;

void createbitree(bitree *bt)//先序建立2叉树
{
char ch;
ch=getchar();
if(ch=='.')(*bt)=NULL;
else
{
*bt=new(struct Node);
(*bt)->data=ch;
createbitree(&(*bt)->lchild);
createbitree(&(*bt)->rchild);
}
}

void countleaf(bitree root)//统计2叉树中叶节点的数目
{
if(root!=NULL)
{
countleaf(root->lchild);
countleaf(root->rchild);
if(root->lchild==NULL&&root->rchild==NULL)
leafcount++;
}
}

bitree xcha(bitree root,char x) //定位x的子树,假设只打了一个x 在树里..
{
if(root&&root->data!=x)
{
xcha(root->lchild,x);
xcha(root->rchild

2叉树 算子树深度的问题 - 源码下载站
以值为x的子树的深度...@~ 原文作者: 2叉树 算子树深度的问题 用户名: ! 查看更多回答 分值:100分 85分 70分 55分 40分 25分 10分 0分 内容: ! (注“!”为必填内容。) 验证码: 上一篇:如何使首页上的所有链接在新的...
www.mpsoft.cn/sort0364/CNET/3407.html

正航软件是致力于管理软件产品研发和服务的领导厂商,产品涉及ERP,CRM,HR,BPM,E-BOOK,..