码迷,mamicode.com
首页 >  
搜索关键字:trees    ( 1351个结果
[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'...
分类:其他好文   时间:2014-06-28 11:57:50    阅读次数:232
LeetCode:Same Tree
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 n...
分类:其他好文   时间:2014-06-19 12:49:17    阅读次数:301
[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 identical an...
分类:其他好文   时间:2014-06-18 12:32:58    阅读次数:169
leetcode - Unique Binary Search Trees
题目:Unique Binary Search TreesGivenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a...
分类:其他好文   时间:2014-06-15 13:16:53    阅读次数:202
leetcode -day28 Unique Binary Search Trees I II
1、 ?? 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 uni...
分类:其他好文   时间:2014-06-15 09:09:00    阅读次数:256
leetcode - Same Tree
题目: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 structurally ...
分类:其他好文   时间:2014-06-15 00:53:09    阅读次数:314
【leetcode】23.Unique Binary Search Trees
以i为根节点时,其左子树构成为[0,...,i-1],其右子树构成为[i+1,...,n]构成。根结点确定时,左子树与右子树的结点个数都是确定的。这样就可以把这个问题化成子问题。因此可以用动态规划解。Sigma(左边的子树可能状态 * 右边子树可能状态) = 当前个数的结点可能的状态数。public...
分类:其他好文   时间:2014-06-10 12:46:05    阅读次数:175
poj 1095 Trees Made to Order
http://poj.org/problem?id=1095先求出n个节点数的二叉树的形态有多少种。卡特兰数f[n]=f[n-1]*(4*n-2)/(n+1);再递归求。 1 #include 2 #include 3 #include 4 #define ll long long 5 #de...
分类:其他好文   时间:2014-06-09 15:14:11    阅读次数:167
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. 1 3 3 2 ...
分类:其他好文   时间:2014-06-08 17:06:58    阅读次数:235
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. ...
分类:其他好文   时间:2014-06-08 15:15:26    阅读次数:223
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!