题目:气你一个整数n,问多少个节点可以生成n个不同的二叉树。
分析:数论,卡特兰数。根据定义即可。
说明:
#include
#include
using namespace std;
long long Cat[100];
int main()
{
Cat[0] = 1LL;
for (int i = 1 ; i < 20 ; ++ i)
Cat[i] = Cat[i...
分类:
其他好文 时间:
2014-10-14 11:54:38
阅读次数:
140
[leetcode]Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x....
分类:
其他好文 时间:
2014-10-14 11:44:49
阅读次数:
140
Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ's undirected graph serialization:Nodes are labeled u...
分类:
其他好文 时间:
2014-10-14 08:29:27
阅读次数:
270
Maximum Depth of Binary TreeGiven a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root ...
分类:
其他好文 时间:
2014-10-12 17:54:08
阅读次数:
177
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.
For example,
Given 1->2->3->3->4->4->5, return 1->2->5.
Given 1->1-...
分类:
其他好文 时间:
2014-10-12 15:51:58
阅读次数:
190
Clone an undirected graph. Each node in the graph contains alabeland a list of itsneighbors.OJ's undirected graph serialization:Nodes are labeled uniq...
分类:
其他好文 时间:
2014-10-12 10:27:37
阅读次数:
135
456789101112131415161718192021// Return #nodes that matches P or Q in the subtree.int countMatchesPQ(Node *root, Node *p, Node *q) { if (!root) retur....
分类:
其他好文 时间:
2014-10-12 06:40:37
阅读次数:
160
Partition List
Total Accepted: 19761 Total
Submissions: 73252My Submissions
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than ...
分类:
其他好文 时间:
2014-10-12 01:31:37
阅读次数:
317
环境:
oracle clusterware:10.2.0.1
redhat 5.5
在验证完相关配置后,提示RAC安装时,报The specified nodes are not clusterable:排查/etc/hosts和信任关系没有错误的情况下,那么要注意rootpre.sh是否都在任何节点执行了...
分类:
其他好文 时间:
2014-10-11 18:37:56
阅读次数:
241
Minimum Depth of Binary Tree
Total Accepted: 25609 Total
Submissions: 86491My Submissions
Given a binary tree, find its minimum depth.
The minimum depth is the number of nodes along the ...
分类:
其他好文 时间:
2014-10-11 17:41:25
阅读次数:
151