码迷,mamicode.com
首页 >  
搜索关键字:implement queue    ( 10759个结果
集合和泛型
List Class Stack Class Queue Class SortedSet Class System.Collections Class ArrayList 表示动态大小的对象集合,其中的对象是按顺序列出的 IList   ICollection   IEnumerable   ICloneable BitA...
分类:其他好文   时间:2014-06-20 10:13:11    阅读次数:190
leetcode:LRU Cache
1 /* 2 Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set. 3 ...
分类:其他好文   时间:2014-06-11 13:08:46    阅读次数:297
(清理缓存)
一段清理缓存的代码如下:dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), ^{ NSString*cachPath = [NSSearchPathForDirectoriesInD...
分类:其他好文   时间:2014-06-11 12:04:30    阅读次数:183
leetcode——String to Integer (atoi) 字符串转换为整型数(AC)
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 input ca...
分类:其他好文   时间:2014-06-07 12:21:30    阅读次数:284
LeetCode:Next Permutation
题目链接Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not pos...
分类:其他好文   时间:2014-06-07 11:10:30    阅读次数:212
LeetCode:Pow(x, n)
要求Implement pow(x,n)解1. 特例n=0, 直接返回1n=1, 直接返回xn 0 ? n : -n);pow(x, index) = (index %2==1 ? pow(x, index/2)*x : pow(x, index/2));继续优化pow(x, index) = (i...
分类:其他好文   时间:2014-06-06 18:40:43    阅读次数:180
Pow(double x, int n)
Implement pow(x,n).要点:1、注意n是正数还是负数2、当n是负数时,注意n最小值时的处理方法:INT_MIN的绝对值比INT_MAX大1;3、当n为0时,任何非零实数的0次方都是14、尽量使用移位运算来代替除法运算,加快算法执行的速度。5、x取值为0时,0的正数次幂是1,而负数次幂...
分类:其他好文   时间:2014-06-06 15:52:27    阅读次数:274
GCD线程方式
GCD的线程方式是以C语言为基础的多线程技术,总体上分为串行队列和并行队列两种实现方式。 GCD串行队列: #param mark -TWThread.gcd.seral是新创建的队列的名字,主要作用体现在断点调试阶段,可以根据名字判断线程的队列//DISPATCH_QUEUE_SERI...
分类:编程语言   时间:2014-06-02 16:51:59    阅读次数:236
图论-深度优先和广度优先(均非递归)
图论-深度优先和广度优先(均非递归) 不使用递归的原因我这在这不重复。因此如何替代递归呢?请接着看: 深度优先:使用Stack(栈)替代 广度优先:使用Queue(队列)替代 C++代码献上: 1 #include 2 #include 3 #include 4 #incl...
分类:其他好文   时间:2014-06-02 09:40:48    阅读次数:198
HDU 4839 The Game of Coins 概率题。(母函数
The Game of Coins mark: #include"cstdio" #include"iostream" #include"queue" #include"algorithm" #include"set" #include"queue" #include"cmath" #include"string.h" #include"vector...
分类:其他好文   时间:2014-06-01 13:58:31    阅读次数:196
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!