码迷,mamicode.com
首页 >  
搜索关键字:implement stack usin    ( 11956个结果
Problem LRU Cache
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
Leetcode Pow(x,n)
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
Single Number
题目 Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it witho...
分类:其他好文   时间:2014-06-30 19:38:37    阅读次数:226
Single Number II
题目 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...
分类:其他好文   时间:2014-06-30 19:23:18    阅读次数:200
Codeforces 442C Artem and Array(stack+贪心)
题目连接:Codeforces 442C Artem and Array 题目大意:给出一个数组,每次删除一个数,删除一个数的得分为两边数的最小值,如果左右有一边不存在则算作0分。问最大得分是多少。 解题思路:首先将连续的a,b,c,a > b && c > b的情况将c掉,获得min(a,b)分,这样处理后数组变成一个递増再递减的序列,除了最大和第二大的取不到,其他数字均可以得分。 ...
分类:其他好文   时间:2014-06-30 17:00:31    阅读次数:222
Snapshot Types
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
Java的结构之美【2】——销毁对象
先来看一段代码:import java.util.Arrays; import java.util.EmptyStackException; /** * 2014年6月28日09:31:59 * @author 阳光小强 * */ public class Stack { private Object[] elements; private int size = 0; privat...
分类:编程语言   时间:2014-06-30 08:45:00    阅读次数:220
栈模拟队列 队列模拟栈
代码如下: PS:做了一些测试,目前没问题。有问题请指正。。。 {CSDN:CODE:410276} {CSDN:CODE:410278}...
分类:其他好文   时间:2014-06-30 07:57:44    阅读次数:203
leetCode: Single Number II [137]
【题目】 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
LeetCode: LRU Cache [146]
【题目】 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
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!