Find Minimum in Rotated Sorted Array
Suppose a sorted array is rotated at some pivot unknown to you beforehand.
(i.e., 0 1 2 4 5 6 7 might become 4
5 6 7 0 1 2).
Find the minimum element....
分类:
其他 时间:
2015-03-29 12:17:49
收藏:
0 评论:
0 赞:
0 阅读:
267
练习3-72原文Exercise 3.72. In a similar way to exercise 3.71 generate a stream of all numbers that can be written as the sum of two squares in three different ways (showing how they can be so written). 代码...
分类:
其他 时间:
2015-03-29 12:17:39
收藏:
0 评论:
0 赞:
0 阅读:
229
Sqoop1vs Sqoop2
1:两个不同版本,完全不兼容
2:版本号划分方式
Apache:1.4.x~ ,1.99.x~
CDH:sqoop-1.4.3-cdh4,sqoop2-1.99.2-cdh4.5.0/
3:Sqoop2比Sqoop1的改进
引入sqoop server,集中化管理Connector等
多种访问方式:CLI...
分类:
其他 时间:
2015-03-29 12:17:19
收藏:
0 评论:
0 赞:
0 阅读:
930
有些程序要处理二进制问题,每个位只包含0和1;标准库里面有个bitset类简化了 处理,使用方便
输入一个整数n
输出n的二进制,保证多少位,高位不够的话补0
#include
#include
#include
#include
using namespace std;
int main()
{
int n;
while(cin>>n)
{
bits...
分类:
其他 时间:
2015-03-29 12:17:09
收藏:
0 评论:
0 赞:
0 阅读:
170
题意:给你n个数,k个魔法棒,s为所求的数,然后让你找有多少种方法,能够使的这n个数之和为s,其中一个魔法棒可以使的一个数变成他的阶乘。
思路:采用折半搜索,自己太渣。。请看这位大神详解~...
分类:
其他 时间:
2015-03-29 12:16:59
收藏:
0 评论:
0 赞:
0 阅读:
143
五竹,20110418
Redis: A persistent key-value database with built-in net interface written in ANSI-C for Posix systems
1 Redis 内存存储结构
本文是基于 Redis-v2.2.4 版本进行分析.
1.1 Redis 内存存储总体结构
Redis 是支持...
分类:
其他 时间:
2015-03-29 12:16:40
收藏:
0 评论:
0 赞:
0 阅读:
309
#include
using namespace std;
#define INF 0x7ffffff
typedef pair P;
#define maxn 100000+10
struct edge
{
int to;
int cost;
edge(){}
edge(int to_, int cost_)
{
to = to_;
...
分类:
其他 时间:
2015-03-29 12:16:30
收藏:
0 评论:
0 赞:
0 阅读:
96
在泰国举行的谷歌开发者论坛上,谷歌为我们介绍了一个名叫
Glide 的图片加载库,作者是bumptech。这个库被广泛的运用在google的开源项目中,包括2014年google I/O大会上发布的官方app。
它的成功让我非常感兴趣。我花了一整晚的时间把玩,决定分享一些自己的经验。在开始之前我想说,Glide和Picasso有90%的相似度,准确的说,就是Picasso的克隆版本。但是在细...
分类:
其他 时间:
2015-03-29 12:16:19
收藏:
0 评论:
0 赞:
0 阅读:
292
搭框架的过程中遇到的一些问题,问题原因,解决办法。...
分类:
其他 时间:
2015-03-29 12:15:49
收藏:
0 评论:
0 赞:
0 阅读:
224
http://acm.hdu.edu.cn/showproblem.php?pid=4400
Problem Description
Terrorists put some mines in a crowded square recently. The police evacuate all people in time before any mine explodes. Now ...
分类:
其他 时间:
2015-03-29 12:15:19
收藏:
0 评论:
0 赞:
0 阅读:
256
STL 源码剖析
最近打算好好看看STL源码实现...
各种定义找不到头都大了.
首先你需要一个帮手,ctags不行我们就用global(什么东西自己搞定,这么不介绍了).
在STL库的路径下 bits/stringfwd.h你能找到一下定义
你会发现我们常用的标准库类string实质上是basic_string
class string的定义有20...
分类:
其他 时间:
2015-03-29 12:15:09
收藏:
0 评论:
0 赞:
0 阅读:
220
这道题估计数据比较水,爆搜就能过
从这道题了解到strstr在随机数据的时候比kmp快。。。。正所谓KMP是一种很好的思想,但不实用
接下来就是了解了一些c里的库函数,一开始找不到求子串的函数,写完后才找到strncpy这个函数可以求子串
还有一点要注意的就是得到第一个结果的时候本来可以直接跳出的,但直接跳出的时候可能会碰到一些特殊数据,所以还是用个max记录最大的长度吧。。(这里WA了好多...
分类:
其他 时间:
2015-03-29 12:14:59
收藏:
0 评论:
0 赞:
0 阅读:
148
http://acm.hdu.edu.cn/showproblem.php?pid=4403
Problem Description
Aoshu is very popular among primary school students. It is mathematics, but much harder than ordinary mathematics for pri...
分类:
其他 时间:
2015-03-29 12:14:49
收藏:
0 评论:
0 赞:
0 阅读:
238
题意:有n个点,k种交通卡,m条路。 每条路有对应的交通卡,对应的交通卡可能有多张,拥有一张就可以通行。问从0到1,所需要的交通卡最少几张,并输出是哪几张。
做法:因为数据很小,所以可以枚举交通卡,复杂度是2^k=10^6。然后dfs,每个点只走一次,所以复杂度是n。所以总的复杂度是10^7。跑得有点久用了1.7s。...
分类:
其他 时间:
2015-03-29 12:14:39
收藏:
0 评论:
0 赞:
0 阅读:
187
官方题解:
因为我们要求最后的拓扑序列字典序最大,所以一定要贪心地将标号越大的点越早入队。我们定义点i的入度为di。假设当前还能删去k条边,那么我们一定会把当前还没入队的di≤k的最大的i找出来,把它的di条入边都删掉,然后加入拓扑序列。可以证明,这一定是最优的。
具体实现可以用线段树维护每个位置的di,在线段树上二分可以找到当前还没入队的di≤k的最大的i。于是时间复杂度就是O((n+m)lo...
分类:
其他 时间:
2015-03-29 12:14:29
收藏:
0 评论:
0 赞:
0 阅读:
199
Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one an...
分类:
其他 时间:
2015-03-29 12:14:19
收藏:
0 评论:
0 赞:
0 阅读:
177
题目:
Say you have an array for which the ith element
is the price of a given stock on day i.
Design an algorithm to find the maximum profit. You may complete at most two transactions.
Note...
分类:
其他 时间:
2015-03-29 12:14:09
收藏:
0 评论:
0 赞:
0 阅读:
206
1.在Struts2中,当有多个Action使用同一个结果集时,则可以使用全局结果集(GlobalResult),这样就不用在每一个使用同一个结果集的action里面都添加一个result,可以减少代码量,优化struts.xml配置文件,接下来将用一个很简单的小例子来介绍全局结果集。
2.首先,新建一个struts2项目,打开index.jsp页面,编码格式改为utf-8,在对...
分类:
其他 时间:
2015-03-29 12:13:59
收藏:
0 评论:
0 赞:
0 阅读:
117
http://soj.sysu.edu.cn/show_problem.php?pid=1000&cid=1762这题的n达到了1000000,n^2的最长递增子序列做法肯定超时,于是有一种二分的算法,与此题完美地结合起来!达到nlogn的时间复杂度! 1 /* 2 最长递增子序列+二分查找 3 ....
分类:
其他 时间:
2015-03-29 12:12:29
收藏:
0 评论:
0 赞:
0 阅读:
218
STM32学习笔记—点亮led灯STM32的I/O口有很多的功能,所以称为GPIO(GENERAL PURPOSE)其中GPIO又分为A,B,C,D,E,F,G不同的组,每个组端口又分为0~15,共16个不同的引脚,不同的芯片引脚数量也不同,所用的学习板为STM32F103RBT6;I/O口的八种模...
分类:
其他 时间:
2015-03-29 12:11:49
收藏:
0 评论:
0 赞:
0 阅读:
285