AtomicInteger中用到的CAS(compare and swap)是整个concurrent的基石。上面分析了实现所用到的原理,其中缓存锁定方式只需要理解能够保证同步的原理即可。...
分类:
编程语言 时间:
2014-11-05 14:50:52
阅读次数:
137
Consider N coins aligned in a row. Each coin is showing either heads or tails. The adjacency of these coins is the number of adjacent pairs of coins with the same side facing up.
It must return the...
分类:
其他好文 时间:
2014-11-05 10:57:41
阅读次数:
2365
在计算机上安装Linux系统,对硬盘进行分区是一个非常重要的步骤,下面介绍几个分区方案。方案1/:建议大小在5GB以上。swap:即交换分区,建议大小是物理内存的1~2倍。方案2/boot:用来存放与Linux系统启动有关的程序,比如启动引导装载程序等,建议大小为100MB。/:Linux系统的根目...
分类:
系统相关 时间:
2014-11-05 10:30:46
阅读次数:
220
C++中的高阶手法就会用到泛型编程,主要有函数模板, 在程序中使用模板的好处就是在定义时不需要指定具体的参数类型,而在使用时确可以匹配其它任意类型, 定义格式如下template T func(T ...) {}让我们来看一个简单例子,写一个swap()将两个整数交换位置,void swap(int...
分类:
编程语言 时间:
2014-11-05 01:46:21
阅读次数:
186
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.
For example,
Given
1->2->3->3->4->4->5, return
1->2->5.
Given
1...
分类:
其他好文 时间:
2014-11-04 22:55:40
阅读次数:
300
又加强了 对线段树 延迟标记的理解~~题意很简单 给你一串数字01组成. 每次必须操作K个数 将其翻转 即0->1 1->0 就相当 对于一段区间 [ L , L+K-1 ] 的0和1的数量 进行swap操作首先 解这题 一点必须想到 求最少操作次数 肯定是从最左边开始.那么我每次 query(fi...
分类:
其他好文 时间:
2014-11-04 21:08:19
阅读次数:
220
Surprising Strings
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 6017
Accepted: 3934
Description
The D-pairs of a string of letters are the ordered pai...
分类:
其他好文 时间:
2014-11-04 17:31:40
阅读次数:
192
TreeView控件显示数据库,Nodes集合的Add方法.Treeview控件的Nodes集合包含多个子节点,节点也可以包含另外的节点.通过节点的backcolor属性设置背景色.具体代码测试:usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawi..
分类:
数据库 时间:
2014-11-04 15:21:14
阅读次数:
216
Given a singlylinked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For examp...
分类:
其他好文 时间:
2014-11-04 14:34:54
阅读次数:
155
http://www.hankcs.com/nlp/ansj-word-pairs-array-tire-tree-achieved-with-arrays-dic-dictionary-format.htmlarrays.dic是一个双数组Trie树格式的词典,用文本的形式储存了索引,字串,bas...
分类:
编程语言 时间:
2014-11-04 12:32:05
阅读次数:
304