LeetCode: Scramble StringGiven a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is o...
分类:
其他好文 时间:
2014-09-01 22:42:34
阅读次数:
308
LeetCode: Gray CodeThe gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n represen...
分类:
其他好文 时间:
2014-09-01 22:31:13
阅读次数:
289
给出一数组a,然后要求查询a[i..j]的第k大的数划分树#include#include#includeusingnamespacestd;constintN=100005;structNode{intl,r;intmid(){return(l+r)>>1;}}tree[Nmidval){val[...
分类:
其他好文 时间:
2014-09-01 22:30:23
阅读次数:
309
在fl2440开发板上移植第三方程序lrzsz,tree
分类:
其他好文 时间:
2014-09-01 21:03:53
阅读次数:
375
源码ex6-2.rb :types_of_people = 10x = "There are #{types_of_people} types of people." binary = "binary"do_not = "don't"y = "Those who know '#{binary}...
分类:
其他好文 时间:
2014-09-01 17:32:43
阅读次数:
171
问题描述
Given two binary trees, write a function to check if they are equal or not.
Two binary trees are considered equal if they are structurally identical and the nodes have the same value.
解决...
分类:
其他好文 时间:
2014-09-01 15:40:33
阅读次数:
146
题意:
给一棵树
给出两种操作:
1.在某个结点上加上一个值,在这个结点所有的儿子结点上减去这个值,在这个结点的所有孙子结点上加上这个值,在所有曾孙子结点上减去这个值,直到底。
2.查询某个结点上的值
分析:
把这个问题转化为树状数组的区间求和
样例经过dfs处理后如下,每个结点处理出了两个值l,r,层数1,2,3...,层数为奇数的属性为0,层数为偶数的属性为1
可以看到...
分类:
其他好文 时间:
2014-09-01 14:09:03
阅读次数:
213
题目大意:
给定一个无向图,每条边有两个权值ai和bi,从1走到N,设路径上a权的最大值为A,b权的最大值为B,求A+B的最小值
首先这题如果只有一个权值就是水题无误……但是多了个权值之后我们就要好好考虑一下了
我们对a排序,枚举a,对于每一次枚举求b权最大值的最小值即可
跑M遍SPFA肯定超时无误 网上很多人写了LInk-Cut-Tree维护动态最小生成树 我的LCT没写明白 就去写了S...
分类:
其他好文 时间:
2014-09-01 14:06:53
阅读次数:
1733