![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
树的遍历
TheWise_lzy
已毕业,社畜一枚
展开
-
1138 Postorder Traversal (25 分) 给出先序和中序遍历,求后序遍历的第一个结点
Suppose that all the keys in a binary tree are distinct positive integers. Given the preorder and inorder traversal sequences, you are supposed to output the first number of the postorder traversal se...原创 2019-08-23 20:15:01 · 479 阅读 · 0 评论 -
1020 Tree Traversals (25 分) 给出后序和中序遍历,输出层序遍历
1020Tree Traversals(25分) Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order ...原创 2019-08-18 21:22:19 · 196 阅读 · 0 评论 -
【MOOC-浙大数据结构】第三周的编程作业——建树,树的遍历
第三周的编程作业: 1.树的同构 小白专场里讲解了找根节点的方法——没有一个指向他的结点,check一下~ #include<stdio.h> struct TreeNode { char c; int left,right; }t1[15],t2[15]; int BuildTree(struct TreeNode t[]) { int check[15]={0}; ...原创 2019-07-22 21:30:18 · 291 阅读 · 0 评论 -
7-23 还原二叉树 (25 分)
7-23还原二叉树(25分) 给定一棵二叉树的先序遍历序列和中序遍历序列,要求计算该二叉树的高度。 输入格式: 输入首先给出正整数N(≤50),为树中结点总数。下面两行先后给出先序和中序遍历序列,均是长度为N的不包含重复英文字母(区别大小写)的字符串。 输出格式: 输出为一个整数,即该二叉树的高度。 输入样例: 9 ABDFGHIEC FDHGIBEAC 输出样例: ...原创 2019-03-27 21:51:17 · 534 阅读 · 0 评论