码迷,mamicode.com
首页 >  
搜索关键字:swap nodes in pairs    ( 8848个结果
使用CAS实现高效并发处理
在并发处理应用中,一般使用锁的方式来解决竞争问题,但锁的效率比较低,因此,在高并发处理中,无锁队列成为应用的需要。CAS无锁算法主要依赖于处理器的支持,绝大多数处理器都支持: X86平台:CMPXCHG 汇编指令。 在一个指令周期内执行完成,因此是原子性的。 这一原理性操作过程如果采用C描述如下: intcompare_and_swap (int* reg, int old...
分类:其他好文   时间:2014-08-21 19:32:34    阅读次数:207
leetcode之Partition List,Reverse Nodes in k-Group
Partition List Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of...
分类:其他好文   时间:2014-08-21 19:23:34    阅读次数:295
Cracking the Coding Interview 8.5
Implement an algorithm to print all valid combinations of n-pairs of parentheses#includevoid f(int idx,int left,int right,char *buf){ if(left == 0 ...
分类:其他好文   时间:2014-08-21 13:06:34    阅读次数:168
Parameter Transmission
在C++中,函数参数传递有3种方式,分别是按值传递、按地址传递和按引用传递。其测试代码如下: 1 //Parameter Transmission in C++ 2 #include 3 using namespace std; 4 5 void swap_value(int a,int b)...
分类:其他好文   时间:2014-08-21 01:30:23    阅读次数:290
vmstat & mpstat & w
vmstat# vmstat 3 2procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu----- r b swpd free buff cache si so bi ...
分类:其他好文   时间:2014-08-21 01:27:33    阅读次数:276
AIX 第7章 指令记录
要点:AIX文件系统的访问路径AIX文件系统目录树创建AIX文件系统文件系统的卸载和删除文件系统的自动挂载文件系统的容量管理文件系统的一致性管理文件系统的卸载失败文件系统的快照管理LVM常用命令总结AIX存储部署实践存储使用中的例外在UNIX中,每创建一个文件,就会有一个对应的i-nodes,这些连...
分类:其他好文   时间:2014-08-20 23:56:43    阅读次数:285
【Leetcode】Binary Tree Preorder Traversal
Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,2,3].Not...
分类:其他好文   时间:2014-08-20 14:01:43    阅读次数:202
【leetcode】Binary Tree Postorder Traversal
Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[3,2,1].No...
分类:其他好文   时间:2014-08-20 13:58:32    阅读次数:236
UVA 12338 - Anti-Rhyme Pairs(后缀数组+RMQ)
UVA 12338 - Anti-Rhyme Pairs 题目链接 题意:给定一些字符串,每次询问求出两个字符串的最长公共前缀的长度 思路:把字符串排序,就能求出height和rank数组,然后利用RMQ查询即可 代码: #include #include #include #include #include using namespace std; co...
分类:其他好文   时间:2014-08-20 01:24:35    阅读次数:300
【Math】GCD XOR 证明
题目:Given an integer N, and how many pairs (A;B) are there such that: gcd(A;B) = A xor B where 1=2)是不同位数的。和同学讨论后得出如下证明:设最大公约数为 j, 假设这两个数是b 和 b+k*j,(k>....
分类:其他好文   时间:2014-08-19 23:50:55    阅读次数:233
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!