数据结构
文章平均质量分 67
蜀人ing
二十二励 三十而立
展开
-
数据结构之二叉树求叶子节点
代码的关键的如何通过递归来实现对叶子节点的计数, #include"stdio.h" #include"stdlib.h" typedef struct node { char data; struct node *rchild,*lchild; } tree; //按照先序序列的方式构建二叉树 tree* create() { tree *u原创 2016-11-09 19:32:18 · 1431 阅读 · 0 评论 -
数据结构二叉树之通过前序和中序恢复二叉树后续方法输出
#include"stdio.h" #include"stdlib.h" #define max 100 typedef struct node { char data; struct node *rchild,*lchild; } tree; //创建两个字符串数组 void createArray(char q[],char w[]) { gets(q); gets(w); }原创 2016-11-10 00:02:40 · 1417 阅读 · 0 评论 -
数据结构之二叉树按层遍历
#include"stdio.h" #include"stdlib.h" #define max 100 typedef struct node { char data; struct node *rchild,*lchild; } tree; tree* create() { char q; tree *t; q=getchar(原创 2016-11-10 14:03:23 · 455 阅读 · 0 评论 -
数据结构之二叉树深度的求解
转载处:http://blog.pfan.cn/edwardguo/52433.html 题目:二叉树用二叉链表表示,编写求二叉树深度的算法。 答案是: int height(Bitree T) { if (T==NULL) return 0; u=height(T->lchild); v=height(T->rchild); if (u>n) return转载 2016-11-10 14:18:22 · 1750 阅读 · 0 评论