码迷,mamicode.com
首页 >  
搜索关键字:trees    ( 1351个结果
ZOJ 3602 Count the Trees 树的同构 (哈希)
链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4705 题意:给出两棵二叉树A和B,问分别处于A中的子树a和处于B中的子树b结构相同的有多少对。 思路:哈希的想法,不同的数字对应的是不同的结构,比如1代表着单独的叶子结点,2代表着有左子树是叶子结点而没有右子树的子树...每出现一种新的子树情形就记录下来,记录的方式是...
分类:其他好文   时间:2014-09-05 18:17:11    阅读次数:206
给定n求二叉搜索树的个数
Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,Givenn= 3, your program should return all 5 uni...
分类:其他好文   时间:2014-09-04 18:52:29    阅读次数:181
Same Tree
问题描述 Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical and the nodes have the same value. 解决...
分类:其他好文   时间:2014-09-01 15:40:33    阅读次数:146
POJ 2418-Hardwood Species(map)
Hardwood Species Time Limit: 10000MS   Memory Limit: 65536K Total Submissions: 18770   Accepted: 7405 Description Hardwoods are the botanical group of trees that have bro...
分类:其他好文   时间:2014-09-01 12:40:03    阅读次数:196
LeetCode: Unique Binary Search Trees
LeetCode: Unique Binary Search TreesGiven n, how many structurally unique BST's (binary search trees) that store values 1...n? For example,Given n = 3...
分类:其他好文   时间:2014-08-31 22:41:31    阅读次数:361
HDU 1392 Surround the Trees (Graham求凸包周长)
题目链接题意 : 让你找出最小的凸包周长 。思路 : 用Graham求出凸包,然后对每条边求长即可。Graham详解 1 #include 2 #include 3 #include 4 #include 5 #include 6 7 using namespace std ; 8 9...
分类:其他好文   时间:2014-08-29 10:40:37    阅读次数:160
LeetCode: Same Tree
LeetCode: Same TreeGiven two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are struct...
分类:其他好文   时间:2014-08-28 22:40:46    阅读次数:266
UvaLive 6600 Spanning trees in a secure lock pattern 矩阵行列式
链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4611 题意:给一个N*N个点的矩阵(N 思路:题里给的很明白,就是列一个每个点的边的矩阵,然后求子矩阵的行列式就可以了,因为N只有6,所以打表就可以了。 打表代码: #incl...
分类:其他好文   时间:2014-08-28 17:01:00    阅读次数:350
41. Unique Binary Search Trees && Unique Binary Search Trees II
思路: f(n) = Σi=1n f(n-i)*f(i-1), 其中 f(0) = f(1) = 1; 利用动归记下之前的 f(2)~f(n-1)即可。 思路:分别以 1~n 为根节点,左右子树根的集合数量相乘,递归,依次得出结果。
分类:其他好文   时间:2014-08-27 20:22:28    阅读次数:278
HDU3240-Counting Binary Trees(Catalan数+求逆元(非互质))
Counting Binary Trees Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 564    Accepted Submission(s): 184 Problem Description There ...
分类:其他好文   时间:2014-08-25 17:07:44    阅读次数:266
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!