Given a root of Binary Search Tree with unique value for each node. Remove the node with given value. If there is no such a node with given value in t...
分类:
其他好文 时间:
2014-12-30 08:08:42
阅读次数:
236
Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. 1.....
分类:
其他好文 时间:
2014-12-29 22:57:50
阅读次数:
205
Combination SumGiven a set of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Thes...
分类:
其他好文 时间:
2014-12-29 22:56:46
阅读次数:
207
Combination Sum IIGiven a collection of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sum...
分类:
其他好文 时间:
2014-12-29 22:44:29
阅读次数:
185
4SumGiven an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives the sum...
分类:
其他好文 时间:
2014-12-29 19:57:29
阅读次数:
145
最小生成树
定义:n个顶点网络的生成树有n个结点,n-1条分枝。假设网络中有m条边(m≥n-1),用MST表示许多可能的生成树的集合,每棵树中n-1条分枝上的权之和用WG(T)表示,则使得WG(Tmin)=Min{WG(T)|
T MST}的生成树Tmin便是网络的最小生成树。
构造最小生成树的算法:Prime算法 和Kruskal算法
Kruskal算法...
分类:
编程语言 时间:
2014-12-29 13:49:54
阅读次数:
191
最小生成树:n个顶点网络的生成树有n个结点,n-1条分枝。假设网络中有m条边(m≥n-1),用MST表示许多可能的生成树的集合,每棵树中n-1条分枝上的权之和用WG(T)表示,则使得WG(Tmin)=Min{WG(T)|
T MST}的生成树Tmin便是网络的最小生成树。
构造最小生成树的算法:Prime算法 和Kruskal算法
Prime算法
1....
分类:
其他好文 时间:
2014-12-29 13:47:36
阅读次数:
257
3SumGiven an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:El...
分类:
其他好文 时间:
2014-12-29 13:41:38
阅读次数:
139
题目描述:
Follow up for "Unique Paths":
Now consider if some obstacles are added to the grids. How many unique paths would there be?
An obstacle and empty space is marked as 1 and 0 respectivel...
分类:
其他好文 时间:
2014-12-29 10:28:11
阅读次数:
183
4SumGiven an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives the sum...
分类:
其他好文 时间:
2014-12-28 20:45:39
阅读次数:
121