码迷,mamicode.com
首页 >  
搜索关键字:map stl    ( 31924个结果
boost库使用:仿SGI-STL实现的一个树节点内存allocator
1 ////////////////////////////////////////////////////////////////////////// 2 //code by hzs 3 //email: huangzhesi@gmail.com 4 //Last modified: 2014-....
分类:其他好文   时间:2014-05-27 02:41:54    阅读次数:218
Leetcode | Trapping Rain Water
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining....
分类:移动开发   时间:2014-05-19 19:20:26    阅读次数:332
《Effective C++》item25:考虑写出一个不抛异常的swap函数
std::swap()是个很有用的函数,它可以用来交换两个变量的值,包括用户自定义的类型,只要类型支持copying操作,尤其是在STL中使用的很多,例如:int main(int argc, _TCHAR* argv[]) { int a[10] = {1,2,3,4,5,6,7,8,...
分类:编程语言   时间:2014-05-19 15:22:41    阅读次数:378
Java基础知识
volatile:java关键字,意为易变的,不稳定的,标识修饰java同步字段,示例:java单利模式public class ApplicationCache{ private Map attributeMap; // volatile so that JVM out-of-order...
分类:编程语言   时间:2014-05-19 14:56:56    阅读次数:334
stl sort分析
最近写代码,无意中发现了一个坑,关于自定义比较函数的stl sort函数的坑,于是记录下来。先贴代码: 1 #include 2 #include 3 #include 4 5 struct finder 6 { 7 bool operator()(int first, in...
分类:其他好文   时间:2014-05-19 14:47:48    阅读次数:319
寻找数组中重复次数最多的数
#include#includeusing namespace std;int helper(const int a[],const int n){ map m; for(int i = 0;i::iterator comp = m.begin(); for( map::iterator it...
分类:其他好文   时间:2014-05-19 12:44:34    阅读次数:270
MapReduce入门
说明MapReduce是一种分布式计算模型,解决海量数据的计算问题,主要有Map和Reduce组成用户使用时需要实现map()和reduce()两个函数,两个函数的形参都是key/value键值对若以eclipse为开发环境,运行时出现内存不足的情况,需要修改虚拟机的参数 (例如把Default V...
分类:其他好文   时间:2014-05-19 11:56:18    阅读次数:352
STL算法 — sort
能使用STL的sort系列算法的前提是容器的迭代器必须为随机迭代器。所以,vector和deque天然适用。STL的sort算法采用了一些策略,在不同情况下采用不同的排序算法,以达到各种算法优势互补的效果。基本的原则是:数据量大时采用快速排序,数据量小时采用插入排序(这是对快排常用的一种优化策略),递归层次过深改用堆排序。 首先是插入排序。它的平均和最坏时间复杂度都为O(N²),量级小于...
分类:其他好文   时间:2014-05-18 14:40:31    阅读次数:241
C++与数据结构 -- stack实现表达式求值[注释版]
有好多朋友评论以前的那篇博文说:代码中间没有注释。由于课程一直比较紧张,所以答应的注释直到今天才写,发表出来,给大家共享!#include #include #include #include #include using namespace std; //为+,-,*,/运算符 设定优先级 map priority; void initMap() { //+,-运算符的优先级...
分类:编程语言   时间:2014-05-18 07:35:21    阅读次数:290
Android Intent传递对象小结
Android Intent传递对象小结 Intent 传递复杂类型,例如:数组,ArrayList类型,传递类对象...
分类:移动开发   时间:2014-05-18 06:54:14    阅读次数:338
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!