![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
树
文章平均质量分 84
guojiaqi007
这个作者很懒,什么都没留下…
展开
-
九度 oj 题目1044:Pre-Post (确定树的状态)
http://ac.jobdu.com/problem.php?pid=1044参考了1.http://blog.csdn.net/yangnanhai93/article/details/406585712.http://www.acmerblog.com/jiudu-1044-2225.html#include #include static int C[22][2转载 2017-02-06 17:03:32 · 572 阅读 · 0 评论 -
pat 1043. Is It a Binary Search Tree (25)
1043. Is It a Binary Search Tree (25)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueA Binary Search Tree (BST) is r转载 2017-03-09 20:20:12 · 303 阅读 · 0 评论 -
pat 1021. Deepest Root (25)
https://www.patest.cn/contests/pat-a-practise/1021照抄了http://blog.csdn.net/jtjy568805874/article/details/50805402里面用到了求树的半径的方法,1)用任何一个点dfs 找到最深的深度,所有深度最深的node 是半径上的点。2)再用任意一个半径上的点dfs,找到转载 2017-03-05 17:40:40 · 270 阅读 · 0 评论 -
pat 1004. Counting Leaves (30)
https://www.patest.cn/contests/pat-a-practise/1004这个题做的不好一开始用 链接法构造树,但是发现如果有的节点的孩子信息先给出,但是他的父节点的孩子信息还没给出(就是这个点还没建出来)。是会出问题的。开始就就没想到!!!啊!后来参考了:http://www.liuchuo.net/archives/2229#i转载 2017-02-25 10:49:46 · 178 阅读 · 0 评论 -
九度 oj 题目1009:二叉搜索树
http://ac.jobdu.com/problem.php?pid=1009#include #include #include using namespace std;#define rep(i,j,k) for(int i=j;i<=k;i++)#define inone(i) scanf("%d",&i)//typedef struct nd { int v;原创 2017-03-08 12:36:10 · 302 阅读 · 0 评论 -
pat-top 1006. Tree Traversals - Hard Version (35)
https://www.patest.cn/contests/pat-t-practise/1006code 来自于http://blog.csdn.net/jtjy568805874/article/details/50759512dfs 在中序遍历序列中穷举 root 的位置,因为root可能会被替换,所以使用数组存储树。#include #include #i转载 2017-03-01 21:39:08 · 2364 阅读 · 1 评论 -
pat 1123. Is It a Complete AVL Tree (30)
https://www.patest.cn/contests/pat-a-practise/1123参考了:http://www.liuchuo.net/archives/2732#include #include using namespace std;typedef struct node { int v; struct node * left, *right;转载 2017-02-21 09:50:14 · 220 阅读 · 0 评论 -
pat 1119. Pre- and Post-order Traversals (30)
https://www.patest.cn/contests/pat-a-practise/1119#include typedef struct node { int v; struct node * left, *right; node(int x) : left(NULL), right(NULL) { v = x; }}Node;bool build(No原创 2017-02-19 17:08:00 · 244 阅读 · 0 评论 -
pat 1115. Counting Nodes in a BST (30)
https://www.patest.cn/contests/pat-a-practise/1115#include typedef struct node { int v; struct node * left, * right; node(int x) :left(NULL),right(NULL) { v = x; }}Node;int deep,n1,n原创 2017-02-19 13:40:39 · 216 阅读 · 0 评论 -
pat 1110. Complete Binary Tree (25)
https://www.patest.cn/contests/pat-a-practise/1110层序遍历,如果没有child时打标记,如果再出现inValid#include #include #include #include #include #include #define MAXN 21using namespace std;typedef s原创 2017-02-18 15:41:14 · 186 阅读 · 0 评论 -
九度 oj 题目1090:路径打印
http://ac.jobdu.com/problem.php?pid=1089#include #include using namespace std;typedef struct node{ string name; struct node * first_child; struct node * next_sibling;}Node; Node原创 2017-02-07 16:58:37 · 726 阅读 · 0 评论 -
pat 1020. Tree Traversals (25)
1020. Tree Traversals (25)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueSuppose that all the keys in a binary tree原创 2017-03-12 12:39:54 · 304 阅读 · 0 评论