Problem Description:
Given a binary tree, flatten it to a linked list in-place.
For example,
Given
1
/ 2 5
/ \ 3 4 6
The flattened tree sho...
分类:
其他好文 时间:
2014-08-15 10:43:28
阅读次数:
198
http://acm.hdu.edu.cn/showproblem.php?pid=4288题意:add 就是在集合里面加上一个数x; del 就是从集合里删去一个数x; sum是求位置i%5==3的数的和。tree[i].sum[5] 里面数组存的是不同位置%5之后分别对应的和。 1 #incl....
分类:
其他好文 时间:
2014-08-15 09:20:57
阅读次数:
242
实验名称:使用生成树协议给交换机配置根网桥实验拓扑:实验步骤:1)给第一台三层交换机配置为vlan1的根网桥,vlan2的次网桥2)给第二台三层交换机配置为vlan1的次网桥,vlan2的根网桥3)分别给两个二层交换机配置vlan24)查看交换机的spanning-tree信息(以第一个三层交换机..
分类:
其他好文 时间:
2014-08-15 02:43:37
阅读次数:
475
伸展树和AVL树不一样,伸展树并不保证每次操作的时间复杂度为O(logn),而保证任何一个m个操作的序列总时间为O(mlogn)。伸展树的基本思想是:每个结点被访问时,使用AVL树的旋转操作把它移动到根。由于旋转是自底向上的,所以需要设置父亲指针,而不像AVL树那样以儿子为轴旋转。伸展操作(spla...
分类:
其他好文 时间:
2014-08-14 23:30:16
阅读次数:
280
1、折半查找 1 // 递归算法 2 int BinarySearch(int item, Node *elem, int left, int right) 3 { 4 int mid = -1; 5 if(left item)10 mid = Binary...
分类:
其他好文 时间:
2014-08-14 23:06:56
阅读次数:
241
这一节学习树状图的制作。树状图的制作和集群图完全相同,经过这两种 layout 转换后的数据也很相似。...
分类:
Web程序 时间:
2014-08-14 20:46:39
阅读次数:
303
Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 ...
分类:
其他好文 时间:
2014-08-14 20:20:09
阅读次数:
206
Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,Givenn= 3, your program should return all 5 uni...
分类:
其他好文 时间:
2014-08-14 20:16:29
阅读次数:
219
标准的二分查找:binary_search int bsearch(int a[],int l,int r,int x){ int m; while(l>2; if(a[m]==x) return m; else if(a[m]>x) r = m-1; else l ...
分类:
其他好文 时间:
2014-08-14 19:33:59
阅读次数:
226
历史不容假设[问题描述]Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3retu...
分类:
其他好文 时间:
2014-08-14 19:30:29
阅读次数:
191