码迷,mamicode.com
首页 >  
搜索关键字:trees    ( 1351个结果
S-Trees UVA 712
说说: 先来说一下题意,题意感觉挺难描述的。有如下这样一棵树: 每一层都有一个变量描述,如左树,从根节点到倒数第二层为x1,x2,x3,而右树为x3,x1,x2,这在开始的时候会给定的。然后题目也会给你从左到右叶子节点所代表的数值,只可能是0或1.最后,会给你一串01数字,代表的是x1,x2,x3...的数值。相当于告诉你从树的根到叶子节点行走的路径。比如右树,从根到倒数第二层的变...
分类:其他好文   时间:2014-09-12 20:48:14    阅读次数:239
UVa 10303 - How Many Trees?
题目:求n个节点(元素不同)的BST的个数。 分析: 说明:...
分类:其他好文   时间:2014-09-12 20:47:24    阅读次数:415
UVa 10007 - Count the Trees
题目:统计n个节点的二叉树的个数。 分析:组合,计数,卡特兰树...
分类:其他好文   时间:2014-09-12 20:47:14    阅读次数:154
LeetCode-- Unique Binary Search Trees II
递归 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNode...
分类:其他好文   时间:2014-09-12 11:36:23    阅读次数:183
Undraw the Trees UVA 10562
说说: 这道题略坑,好久没做过这么坑的题目了QAQ。这题初看挺复杂的,其实就是个树的遍历问题而已。首先题目给你类似如下的一个结构:     A     | -------- B  C   D    |   |  ----- -  E   F G 这其实是一棵树。‘|’,‘-’可以看成是树干。然后节点字符是除‘|’,‘-’,‘#’,‘ ’以外的其他可显示的字符。若一个节点有子节点,...
分类:其他好文   时间:2014-09-10 19:32:41    阅读次数:230
LeetCode——Unique Binary Search Trees II
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n. For example, Given n = 3, your program should return all 5 unique BST's shown below. 1 3...
分类:其他好文   时间:2014-09-09 12:31:39    阅读次数:143
Leetcode: Unique Binary Search Trees II
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.For example,Given n = 3, your program should return all ...
分类:其他好文   时间:2014-09-07 07:38:14    阅读次数:315
红黑树
Left-Leaning Red-Black Trees,Dagstuhl Workshop on Data Structures, Wadern, Germany, February, 2008,直接下载:http://www.cs.princeton.edu/~rs/talks/LLRB/Red...
分类:其他好文   时间:2014-09-06 23:40:34    阅读次数:425
POJ 3522 Slim Span
Given an undirected weighted graph G , you should find one of spanning trees specified as follows. The graph G is an ordered pair (V, E) , where V is a set of vertices {v1, v2,..., vn} and E is a...
分类:其他好文   时间:2014-09-06 22:36:34    阅读次数:358
ZOJ--3602--Count the Trees【DFS+Hash】树的同构
链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3602 题意:给出一棵有n个节点的二叉树和一棵有m个节点的二叉树,给出每个节点的左右子树信息,问这两棵树有几个相同的子树。 思路:树的同构,比赛时没想法,赛后看的别人的解题报告。实际上是给每个节点的左右子树一个哈希值,不用像字符串哈希那么麻烦,直接给每个子树...
分类:其他好文   时间:2014-09-05 18:18:31    阅读次数:251
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!