package foo;import java.io.File;import java.io.FileNotFoundException;import java.util.Queue;import java.util.Scanner;import java.util.Stack;import jav...
分类:
其他好文 时间:
2014-07-07 18:42:45
阅读次数:
142
Problem Description:Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.ge...
分类:
其他好文 时间:
2014-07-07 16:41:12
阅读次数:
237
Implement pow(x,n).明显的二分解决由于n不可能总是偶数, 如果n是正奇数,那么n个x的乘积等于两部分的乘积再乘以x 如果n是负奇数,那么n个x的乘积等于两部分乘积再乘以1/xclass Solution {public: double pow(double x, int ...
分类:
其他好文 时间:
2014-07-07 15:00:12
阅读次数:
183
多进程通信queue和pipe的区别: pipe用来在两个进程间通信。queue用来在多个进程间实现通信。 此两种方法为所有系统多进程通信的基本方法,几乎所有的语言都支持此两种方法。1)Queue & JoinableQueuequeue用来在进程间传递消息,任何可以pickle-able的对象都可...
分类:
编程语言 时间:
2014-07-07 14:49:49
阅读次数:
321
Volume managers Some Unix systems have snapshot-capable logical volume managers. These implement copy-on-write on entire block devices by copying chan...
分类:
其他好文 时间:
2014-06-30 14:53:23
阅读次数:
271
代码如下:
PS:做了一些测试,目前没问题。有问题请指正。。。
{CSDN:CODE:410276}
{CSDN:CODE:410278}...
分类:
其他好文 时间:
2014-06-30 07:57:44
阅读次数:
203
今天的微博有人讨论到对象池,我想到之前项目的实现,应该用模板来实现啊,唉,还是被前人的想法给框定了,不过实现一个特别简单,花了几分钟写了个:
#include
#include
using namespace std;
const int DefaultPoolSize = 1024;
template
class ObejctPool{
private:
queue m_OriBl...
分类:
编程语言 时间:
2014-06-30 00:25:01
阅读次数:
259
【题目】
Given an array of integers, every element appears three times except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
【题意】
给定一个整数以外,其中除了一个整数只出现一次以外...
分类:
其他好文 时间:
2014-06-29 22:52:35
阅读次数:
246
【题目】
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.
get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1.
se...
分类:
其他好文 时间:
2014-06-29 22:45:26
阅读次数:
358
本文将介绍一些常用数据结构,包括 Array, Linked List, List, HashTable, Stack, Queue 等。并同时介绍关于这些基本数据结构的常用操作的复杂度以及如何选择使用合适的数据结构。
分类:
其他好文 时间:
2014-06-29 20:26:01
阅读次数:
406