题目:气你一个整数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
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
$ vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
1 4 329796 26040 4528 3...
分类:
系统相关 时间:
2014-10-13 18:24:49
阅读次数:
248
说个案例:一台Apache服务器,由于其MaxClients参数设置过大,并且恰好又碰到访问量激增,结果内存被耗光,从而引发SWAP,进而负载攀升,最终导致宕机。 正所谓:SWAP,性能之大事,死生之地,存亡之道,不可不察...
分类:
其他好文 时间:
2014-10-13 18:08:50
阅读次数:
147
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