码迷,mamicode.com
首页 >  
搜索关键字:implement queue    ( 10759个结果
LeetCode第八题, String to Integer (atoi)
题目原文 Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible in...
分类:其他好文   时间:2014-09-07 11:03:05    阅读次数:237
STL优先队列的使用
STL中有一个优先队列的容器可以使用。【头文件】queue 队列容器vector 向量容器【操作】优先级队列支持的操作q.empty() 如果队列为空,则返回true,否则返回falseq.size()返回队列中元素的个数q.pop() 删除队首元素,但不返回其值q.top() 返回具有最高优先级的...
分类:其他好文   时间:2014-09-06 22:27:13    阅读次数:223
skynet源代码学习 - 从全局队列中弹出/压入一个消息队列过程
学习云风的skynet源代码,简单记录下。void skynet_globalmq_push(struct message_queue * queue) { struct global_queue *q= Q; uint32_t tail = GP(__sync_fetch_and_add(&q->...
分类:Web程序   时间:2014-09-06 17:24:23    阅读次数:228
Argus Beijing 2004 LA3135
【题目讲解】本题就是简单模拟优先队列的使用。下面讲讲队列及优先队列的基础知识:先回顾队列的定义:队列(queue)维护了一组对象,进入队列的对象被放置在尾部,下一个被取出的元素则取自队列的首部。priority_queue特别之处在于,允许用户为队列中存储的元素设置优先级。这种队列不是直接将新元素放...
分类:其他好文   时间:2014-09-06 14:50:33    阅读次数:279
STL之stack,queue,优先队列
1.stack,size(),empty(),pop()函数 #include #include usingnamespacestd; //通过push()方法入栈 //通过size()方法求栈中元素的个数 //通过empty()方法判断栈是否为空 //通过pop()求栈中最顶端的元素 voidmain() {    i...
分类:其他好文   时间:2014-09-06 13:43:33    阅读次数:293
Implement strStr()
Implement strStr().Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack.思路:使用DFS即可。 1 class Solu...
分类:其他好文   时间:2014-09-06 12:10:03    阅读次数:199
数据结构-6-深度广度遍历搜索原理详解
深度广度遍历搜索的定义想必大家都能熟练的掌握了,下面我就通过一个图的实例,把应用的代码直接贴上供大家参考,以后可以直接借鉴或者使用。 #include     #include     #include "Queue.h"    using namespace std;   //图的邻接矩阵存储表示    #define INFINITY INT_MAX    #define MAX...
分类:其他好文   时间:2014-09-06 09:45:43    阅读次数:308
HashMap源码解析
HashMap是Java中使用最多的几种容器之一,和其他List、Set、Queue的各种实现相比,HashSet并没有实现Collection接口,而是实现的是Map接口。HashMap是基于哈希表的Map接口的实现,维护的一个个key - value(键值对)的映射关系,通过使用哈希算法使得对容器中的元素访问更加迅速。在推出HashMap之前,JDK中使用的哈希实现是HashTable,H...
分类:其他好文   时间:2014-09-06 02:15:02    阅读次数:223
CodeForces 91B Queue (线段树单点操作)
Description There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at...
分类:其他好文   时间:2014-09-05 19:56:51    阅读次数:292
python select和socket配合使用基础学习,是python标准库例子
#-*-coding:utf-8-*-#python:2.x__author__='Administrator'importselect,socket,sys,Queue#作用:等待输入或者输出通道已经准备就绪的通知#select模块允许访问特定平台的IO监视函数,可移植接口是POSIX函数sele...
分类:编程语言   时间:2014-09-05 19:39:41    阅读次数:323
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!