In this article I'll discuss the most fundamental technique in concurrent programming known as memory barriers, or fences, that make
the memory state within a processor visible to other processors.
...
分类:
其他好文 时间:
2014-09-02 12:29:24
阅读次数:
266
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining....
分类:
移动开发 时间:
2014-09-01 21:01:33
阅读次数:
220
??Classes类Classes are the most important building block of any object-oriented system. A class is a description of a set of objects that share the sam...
分类:
其他好文 时间:
2014-09-01 19:08:53
阅读次数:
235
Sorting is one of the most usedoperations in real life, where Computer Science comes into act. It iswell-known that the lower bound of swap based sorting is nlog(n).It means that the best possible sor...
分类:
其他好文 时间:
2014-09-01 10:50:23
阅读次数:
234
问题描述
Given a non-negative number represented as an array of digits, plus one to the number.
The digits are stored such that the most significant digit is at the head of the list....
分类:
其他好文 时间:
2014-08-31 23:05:42
阅读次数:
390
refer from :http://explainextended.com/2009/07/16/inner-join-vs-cross-apply/INNER JOINis the most used construct inSQL: it joins two tables together, ...
分类:
移动开发 时间:
2014-08-31 18:29:51
阅读次数:
158
Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (ie...
分类:
其他好文 时间:
2014-08-31 13:05:01
阅读次数:
176
题意:二维坐标系里有 n 个点 (i, ai), ai >= 0,从 (i, ai)到(i, 0)划竖线,共有 n 条竖线。
找出两条竖线,使得它们构成的矩形的面积最大,矩形的高取决于最短的竖线。
思路:贪心
从首尾两个下标head 和trail 处开始扫描,用一个变量 maxArea 保持当前最大的矩形面积。
如果head 指向的竖线短于 trail 的,则右移 head
否则左移 trail
计算面积,更新 maxArea
复杂度:时间O(n),空间O(1)
int maxArea(vector<in...
分类:
其他好文 时间:
2014-08-30 16:27:49
阅读次数:
223
暑假生活开始了,夏日炎炎,集训队想要每天都吃到西瓜。已知n天,每天商店提供一个西瓜,不同的西瓜可以供集训队吃不同的天数,也有不同的价格,问集训队想保证每天都能吃到西瓜的最小花费。
单个数100000,数组大小50000,因此需要用线段树优化。
对于每天的西瓜,不取则从最小值数组里取出当前最小值,取的话则是找出最小值+当天的西瓜价格,并且线段树更新后k天的最小费用。
dp[i][1]=min(...
分类:
其他好文 时间:
2014-08-29 16:11:18
阅读次数:
292
本文为senlie原创,转载请保留此地址:http://blog.csdn.net/zhengsenlie
Trapping Rain Water
Total Accepted: 14568 Total
Submissions: 50810My Submissions
Given n non-negative integers representin...
分类:
移动开发 时间:
2014-08-29 01:24:36
阅读次数:
238