数据结构实验九

上传人:j****9 文档编号:45494205 上传时间:2018-06-17 格式:DOC 页数:2 大小:35KB
返回 下载 相关 举报
数据结构实验九_第1页
第1页 / 共2页
数据结构实验九_第2页
第2页 / 共2页
亲,该文档总共2页,全部预览完了,如果喜欢就下载吧!
资源描述

《数据结构实验九》由会员分享,可在线阅读,更多相关《数据结构实验九(2页珍藏版)》请在金锄头文库上搜索。

1、#include “stdio.h“ #include “malloc.h“ #define maxsize 10 typedef struct node char data;struct node *lchild,*rchild; Bitree; Bitree *Qmaxsize; Bitree *create() char ch;int front,rear;Bitree *T,*s;T=NULL;front=1;rear=0;printf(“建立二叉树n“);ch=getchar();while(ch!=#)s=NULL;if(ch!=)s=(Bitree *)malloc(sizeof

2、(Bitree);s-data=ch;s-lchild=s-rchild=NULL;rear+;Qrear=s;if(rear=1)T=s;else if(s!=NULLelse Qfront-rchild=s;if(rear%2=1)front+;ch=getchar();return T; void visite(Bitree *T) printf(“%cn“,T-data); int countleaf(Bitree *T) if(T=NULL) return 0; else if(T-lchild=NULL) else return (countleaf(T-lchild)+countleaf(T-rchild); main() Bitree *T; T=create(); printf(“叶子结点数%dn“,countleaf(T);

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 中学教育 > 初中教育

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号