Given preorder and inorder traversal of a tree,
construct the binary tree.Note:You may assume that duplicates do not exist in
the tree.思路:由前序遍历数组和中序遍历...
分类:
其他好文 时间:
2014-04-30 02:20:33
阅读次数:
366
DFS。 1 #include 2 #include 3 4 #define MAXNUM
105 5 6 int map[MAXNUM][MAXNUM], ways[MAXNUM][MAXNUM], n, m; 7 8 int dfs(int x,
int y) { 9 int ...
分类:
其他好文 时间:
2014-04-29 23:21:58
阅读次数:
383
如题,列出《随机算法》课程的topic
list,以记录和供有兴趣的朋友研究。Lession1:生日悖论、生日攻击、两个常用数学工具(马尔科夫不等式、切比雪夫不等式)Lession2:radom
quick sort(hw)、矩阵乘法判定、min(max())=max(min())、复杂性类(BPP...
分类:
其他好文 时间:
2014-04-29 16:16:55
阅读次数:
596
2014-04-29
00:15题目:将二叉搜索树展开成一个双向链表,要求这个链表仍是有序的,而且不能另外分配对象,就地完成。解法:Leetcode上也有,递归解法。代码: 1 //
17.13 Flatten a binary search tree into a doubly linked li...
分类:
其他好文 时间:
2014-04-29 14:51:49
阅读次数:
460
矩阵乘法,用DP做各种wa,后来发现原因了。 1 #include 2 #include 3 4
typedef struct { 5 int map[20][20]; 6 } matrix_st; 7 8 matrix_st res, org; 9 int
n, m;10 11 m...
分类:
其他好文 时间:
2014-04-29 11:26:46
阅读次数:
418
注意数据格式,可以是整数,并且注意输出最简化浮点数。 1 #include 2 #include 3
4 #define MAXNUM 420 5 6 char a[MAXNUM], b[MAXNUM], c[MAXNUM], d[MAXNUM]; 7 int
lena, le...
分类:
其他好文 时间:
2014-04-28 14:14:34
阅读次数:
335
.├── 1.txt├── addons│ ├── country-scanner│ ├──
gggooglescan│ ├── hunter│ └── verify-nikto├── CHANGELOG├── INSTALL├── lib│ ├──
colour.rb│ ├── extend-ht...
分类:
Web程序 时间:
2014-04-28 14:10:38
阅读次数:
4375
??
1、Binary Tree Postorder Traversal
Given a binary tree, return the postorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
retu...
分类:
其他好文 时间:
2014-04-27 18:58:59
阅读次数:
481