Given a strings1, we may represent it as a
binary tree by partitioning it to two non-empty substrings recursively.Below is
one possible representation...
分类:
其他好文 时间:
2014-06-04 20:11:38
阅读次数:
303
Given a binary tree, determine if it is a valid
binary search tree (BST).Assume a BST is defined as follows:The left subtree of
a node contains only n...
分类:
其他好文 时间:
2014-06-03 14:00:56
阅读次数:
281
Two elements of a binary search tree (BST) are
swapped by mistake.Recover the tree without changing its structure.Note:A
solution using O(n) space is ...
分类:
其他好文 时间:
2014-06-03 13:53:21
阅读次数:
309
二维费用背包。 1 #include 2 #include 3 4 #define mymax(a,
b) (a>b) ? a:b 5 6 int dp[105][1005]; 7 int time[105], val[105]; 8 9 int
main() {10 int ca...
分类:
其他好文 时间:
2014-05-30 06:35:56
阅读次数:
173
1 #include 2 #include 3 4 #define mymax(a, b)
(a>b) ? a:b 5 6 typedef struct { 7 int x, y, c; 8 } rect_st; 9 10 rect_st
rects[15];11 12 int d...
分类:
其他好文 时间:
2014-05-30 04:35:16
阅读次数:
200
jQuery EasyUI Tree Create from HTML markup Folder
Sub Folder 1 File 11 File 12 File 13 File 2 File 3 File 4 File 5 ...
分类:
Web程序 时间:
2014-05-29 17:48:25
阅读次数:
473
红黑树(Red-Black
Tree)红黑树是一种BST,但是每个节点上增加一个存储位表示该节点的颜色(R或者B);通过对任何一条从root到leaf的路径上节点着色方式的显示,红黑树确保所有路径的差值不会超过一倍,最终使得BST接近平衡;红黑树内每个节点包含五个属性:color,
key, lef...
分类:
数据库 时间:
2014-05-29 16:51:27
阅读次数:
400
01背包。将最大金额作为容量v。概率做乘法。 1 #include 2 #include 3
4 #define mymax(a, b) (a>b) ? a:b 5 6 float dp[10005]; 7 int mon[105]; 8
float fs[105]; 9 10 int ma...
分类:
其他好文 时间:
2014-05-29 12:28:12
阅读次数:
225
先排序预处理,后01背包。 1 #include 2 #include 3 #include 4 5
#define MAX(a, b) (a>b) ? a:b 6 7 int dp[5000]; 8 9 typedef struct {10 int p,
q, v;11 } s...
分类:
其他好文 时间:
2014-05-29 11:40:04
阅读次数:
277
开始没理解题意。原来destinations是指路的序号。而不是点。DP。 1 #include 2
#include 3 4 int dp[2005]; 5 6 typedef struct { 7 int s, e, w; 8 } road_st; 9 10
road_st ro...
分类:
其他好文 时间:
2014-05-29 09:18:50
阅读次数:
325