![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
二叉树
Northenwood
和其光而同其尘
展开
-
二叉树基础
struct node { int data; struct node * l, *r; }; char z[53]; int cn, count, high; struct node * creat()//先序输入 { struct node * root; if(z[++cn] == ',') { root = NULL; ...原创 2018-08-07 15:18:07 · 183 阅读 · 1 评论 -
平衡二叉树的建立
#include <stdio.h> #include <stdlib.h> #include <string.h> struct node { int data, d; struct node *l, *r; }; int max(int a, int b) { return a > b ? a : b; } int deep(...原创 2018-08-15 09:37:27 · 959 阅读 · 0 评论 -
二叉树还原
struct node { char data; struct node * l, *r; }; struct node * build(int l, char xian[55], char zhong[55])//先序+中序还原二叉树 { int i; struct node * t; if(l <= 0) return NULL; ...原创 2018-08-08 10:15:18 · 345 阅读 · 1 评论 -
SDUT OJ 1391 : 数据结构上机测试4.1:二叉树的遍历与应用1
Problem Description 输入二叉树的先序遍历序列和中序遍历序列,输出该二叉树的后序遍历序列。 Input 第一行输入二叉树的先序遍历序列; 第二行输入二叉树的中序遍历序列。 Output 输出该二叉树的后序遍历序列。 Sample Input ABDCEF BDAECF Sample Output DBEFCA Hint Source #include...原创 2018-08-17 08:47:20 · 152 阅读 · 0 评论 -
SDUTOJ 3340
数据结构实验之二叉树一:树的同构 Time Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Problem Description 给定两棵树T1和T2。如果T1可以通过若干次左右孩子互换就变成T2,则我们称两棵树是“同构”的。例如图1给出的两棵树就是同构的,因为我们把其中一棵树的结点A、B、G的左右孩子互换后,就得到另外一棵树。而图...原创 2018-11-08 14:18:45 · 148 阅读 · 0 评论