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
int b = 0, c = 0;// b 输入的0~255之间的数 c 移动位数
printf("请输入一个整数和移动位数\n");
scanf("%d%d", &b, &c);
unsigned char a = b;
unsigned char left = 0;//存储左移之后的结果
unsigned char right = 0;...
分类:
编程语言 时间:
2014-08-15 09:33:07
阅读次数:
255
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diag...
分类:
其他好文 时间:
2014-08-15 09:32:37
阅读次数:
200
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 * 冒泡排序3 */4 void BubbleSort(int *arr, int left, int right)5 {6 for(int i = left; i i; --j) 8 GreatExchange(arr[j-1], ar...
分类:
其他好文 时间:
2014-08-14 23:27:26
阅读次数:
317
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
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path....
分类:
其他好文 时间:
2014-08-14 20:50:59
阅读次数:
192
这一节学习树状图的制作。树状图的制作和集群图完全相同,经过这两种 layout 转换后的数据也很相似。...
分类:
Web程序 时间:
2014-08-14 20:46:39
阅读次数:
303