码迷,mamicode.com
首页 >  
搜索关键字:trees    ( 1351个结果
LeetCode——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 identic...
分类:其他好文   时间:2014-10-07 17:55:43    阅读次数:127
CareerCup Chapter 4 Trees and Graphs
struct TreeNode{ int val; TreeNode* left; TreeNode* right; TreeNode(int val):val(val),left(NULL),right(NULL){}};Not all binary trees are bina...
分类:其他好文   时间:2014-10-07 15:02:23    阅读次数:221
Leetcode:unique_binary_search_trees
给定数n,问有多少种不同的BST(二叉搜索树)...
分类:其他好文   时间:2014-10-06 01:31:09    阅读次数:341
HDU 4010.Query on The Trees 解题报告
题意: 给出一颗树,有4种操作: 1、如果x和y不在同一棵树上则在xy连边 2、如果x和y在同一棵树上并且x!=y则把x换为树根并把y和y的父亲分离 3、如果x和y在同一棵树上则x到y的路径上所有的点权值+w 4、如果x和y在同一棵树上则输出x到y路径上的最大值动态树入门题:#includ...
分类:其他好文   时间:2014-10-04 22:37:27    阅读次数:238
POJ 2029 Get Many Persimmon Trees (二维树状数组)
C - Get Many Persimmon Trees Time Limit:1000MS    Memory Limit:30000KB    64bit IO Format:%I64d & %I64u SubmitStatusPracticePOJ 2029 Description Seiji Hayashi had been a professo...
分类:其他好文   时间:2014-10-03 15:56:34    阅读次数:199
HDU 1392 Surround the Trees(几何 凸包模板)
http://acm.hdu.edu.cn/showproblem.php?pid=1392题目大意: 二维平面给定n个点,用一条最短的绳子将所有的点都围在里面,求绳子的长度。解题思路: 凸包的模板。凸包有很多的算法。这里用Adrew。 注意这几组测试数据 1 1 1 3 0 0 1...
分类:其他好文   时间:2014-10-03 14:04:04    阅读次数:176
acdream 1412 2-3 Trees
2-3 Trees Time Limit: 12000/6000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others) SubmitStatus Problem Description       2-3 tree is an elegant data structure invented by John Ho...
分类:其他好文   时间:2014-10-03 12:58:44    阅读次数:267
acdream1412:2-3 trees 组合数dp
题意:给出一个标准2-3树的叶子节点(最底层节点)个数 L,求2-3数的形成方案数并取余分析:如果有L个叶子枚举每个可以使x*2+y*3=L的xy 那么在最底层就有c(x+y,x)种2,3的放法上一层就是有x+y个叶子的子问题这样就可以递推算了枚举时首先注意到 x=L y=-L 是一组特解,因此可以...
分类:其他好文   时间:2014-10-03 10:26:04    阅读次数:201
红黑树
介绍还有一种平衡二叉树:红黑树(Red Black Tree),红黑树由Rudolf Bayer于1972年发明,当时被称为平衡二叉B树(symmetric binary B-trees),1978年被Leonidas J. Guibas和Robert Sedgewick改成一个比較摩登的名字:红黑...
分类:其他好文   时间:2014-09-29 22:19:41    阅读次数:484
leetcode-Unique Binary Search Trees
Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example, Given n = 3, there are a total of 5 unique BST's. 去网上搜n个二叉搜索树的递推公式或者Catalan数,可以由h(n)=C(2n,n)/(n+1)得到h(n)=[2n*(2n-1)*...(n+2)]/[n!]....
分类:其他好文   时间:2014-09-29 17:57:01    阅读次数:171
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!