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
原题地址:https://oj.leetcode.com/problems/symmetric-tree/题意:判断二叉树是否为对称的。Given a binary tree, check whether it is a mirror of itself (ie, symmetric around ...
分类:
编程语言 时间:
2014-09-29 03:48:56
阅读次数:
195
题目大意:
给定N个点以及每个点的权值,要你处理接下来的M个操作。操作有4种。操作从0到3编号。点从1到N编号。
0:后接两个整数(x,y),代表询问从x到y的路径上的点的权值的xor和。保证x到y是联通的。
1:后接两个整数(x,y),代表连接x到y,若x到Y已经联通则无需连接。
2:后接两个整数(x,y),代表删除边(x,y),不保证边(x,y)存在。
3:后接两个整数(x,y),代...
分类:
其他好文 时间:
2014-09-28 21:01:05
阅读次数:
230
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
For example, this binary tree is symmetric:
1
/ 2 2
/ \ / 3 4 4 3
But the f...
分类:
其他好文 时间:
2014-09-28 20:10:56
阅读次数:
178
通过查看android源码目录下的build/envsetup.sh文件,可知:- m: Makes from the top of the tree.- mm: Builds all of the modules in the current directory.- mmm: Builds all...
分类:
移动开发 时间:
2014-09-28 19:33:54
阅读次数:
194
http://blog.csdn.net/smallfish1983/article/details/38078019照着上面那哥们写的,初学,不要吐血,基本功能实现了。root@ubuntu12:~/ansible/tornado#tree.├──templates│├──index.html│└──result.html└──test.pyroot@ubuntu12:~/ansible/tornado#cattest.py#c..
分类:
数据库 时间:
2014-09-28 18:53:17
阅读次数:
368
android.view.InflateException: Binary XML file line #2: Error inflating class 的解决方法
java.lang.RuntimeException: Unable to start activity ComponentInfo{cn.xs8.app/cn.xs8.app.activity.news.Xs8_News...
分类:
移动开发 时间:
2014-09-28 18:36:16
阅读次数:
180
Tree
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 700 Accepted Submission(s): 145
Problem Description
You are given a tree (...
分类:
其他好文 时间:
2014-09-28 18:12:06
阅读次数:
224
Given a binary tree containing digits from 0-9 only, each root-to-leaf
path could represent a number.
An example is the root-to-leaf path 1->2->3 which represents the number 123.
Find the tota...
分类:
其他好文 时间:
2014-09-28 18:02:24
阅读次数:
182
题目大意:维护一种树形数据结构,支持以下操作:
1.树上两点之间的点权值+k。
2.删除一条边,增加一条边,保证加边之后还是一棵树。
3.树上两点之间点权值*k。
4.询问树上两点时间点的权值和。
思路:利用动态树维护这棵树,lct的裸题。如果不会下传标记的,先去做BZOJ1798,也是这样的标记,只不过在线段树上做,比这个要简单许多。
这个也是我的LCT的第一题,理解起来十分...
分类:
其他好文 时间:
2014-09-28 15:06:02
阅读次数:
228