# include
# include
# include
# include
# include
# include
using namespace std;
int main()
{
mapq;
map::iterator p;
int n,name,num;
while(~scanf("%d",&n),n)
{
if(n=...
分类:
其他好文 时间:
2014-11-06 21:59:44
阅读次数:
207
想要创建你自己的、独特命名的分派队列:使用 dispatch_queue_create 函数。讨论:利用 GCD,你可以创建你自己的串行分派队列:我们将使用 dispatch_queue_create 函数创建串行队列。这个函数的第一个参数是 C 字符串(char *),它将唯一标识系统中的串行队列...
分类:
其他好文 时间:
2014-11-06 19:48:40
阅读次数:
164
ios中多线程有三种,NSTread,NSOperation,GCD这篇就讲讲GCD的基本用法平时比较多使用和看到的是:dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ //...
分类:
移动开发 时间:
2014-11-06 19:08:28
阅读次数:
177
首先定义队列的基本结构,队列和栈不同之处在于队列需要两个指针,一个指向头,一个指向尾
String[] queue;
int front = 0;
int rear = 0;
构造方法
public QueueOfStrings(int capacity) {
queue = new String[capacity];
}
进队列
public void enqueu...
分类:
编程语言 时间:
2014-11-06 02:05:20
阅读次数:
260
DescriptionRailway tickets were difficult to buy around the Lunar New Year in China, so we must get up early and join a long queue…The Lunar New Year ...
分类:
其他好文 时间:
2014-11-05 17:03:26
阅读次数:
150
n*m矩阵,起点@,从矩阵中拿k个物品的最小代价
水BFS
#include "stdio.h"
#include "string.h"
#include "queue"
using namespace std;
int b[]={1,2,4,8,16};
int dir[4][2]={{1,0},{-1,0},{0,1},{0,-1}};
struct node
{
i...
分类:
其他好文 时间:
2014-11-05 10:53:34
阅读次数:
165
本文有关栈的介绍部分参考自网站数据结构。 1. 队列 1.1 队列的定义 队列(Queue)是只允许在一端进行插入,而在另一端进行删除的运算受限的线性表。 (1)允许删除的一端称为队头(Front)。 (2)允许插入的一端称为队尾(Rear)。 (3)当队列中没有元素时称为空队列...
分类:
编程语言 时间:
2014-11-04 22:23:26
阅读次数:
374
BOOST_FOREACH可以方便的遍历STL容器.
只需要头文件:
#include
然后遍历容器vector/list/set/deque/stack/queue都是类似的:
vectorint32_t> _v;
BOOST_FOREACH(int32_t value,_v)
{
//这里就可以访问value
}
同时元素还支持引用,const,比如...
分类:
其他好文 时间:
2014-11-04 11:03:46
阅读次数:
154
CPU LOAD通俗点讲,即当前系统正在执行及等待执行的任务数量。 维基百科上面对LOAD的详细解释:Each process using or waiting for CPU (the ready queue or run queue) increments the load number by ...
分类:
系统相关 时间:
2014-11-03 23:54:38
阅读次数:
381
一个客户端连接网络模块工作(一个连接的过程)监听线程收到一个连接后像轮询线程的连接队列中push一个conn_queue_item,然后向soketpair中写入一个字节此时子线程就是自动调用设置的事件,然后从连接队列中pop一个socket然后创建一个机遇socket的bufferevent在cr...
分类:
其他好文 时间:
2014-11-03 22:18:45
阅读次数:
131