一、迭代器概述
这个标题其实有点“标题党”的含义,因为C++在标准库中的实现迭代器的方式只有一种,也就是为类定义begin()和end()函数,C++11增加了range for语句,可以用来遍历迭代器中的元素。实现迭代器的第二种方式,就是用C++模拟C#和Java中的迭代器模式,并且我们可以定义出自己的foreach语句。除此之外,迭代器可能还有很多种实现的方法,各个库也会多自己的迭代器的...
分类:
编程语言 时间:
2014-06-28 07:38:06
阅读次数:
240
Step 1: n ==1 : return 1 n == 2 : return [1,1],[2]Step 2:for n > 2a.arr.push(n)b.arr.push([n-1,1])c.1 get result of recursion(n-2)c.2 combine n==2 & result => retc.3 remove duplicate record in retcod...
分类:
其他好文 时间:
2014-06-28 07:17:11
阅读次数:
255
集合框架最大的作用就是维护一组类型相同的对象。只是不同的类有不同的行为和性能。通常关注以下这些行为:
能否存放重复的元素遍历的顺序是怎样的是否支持多线程
下面首先介绍集合的常用,随后根据每种行为分别进行讨论。
常用操作
常用的操作一般就是增加删除查询。常用的增加操作有add、addAll,常用的删除操作有remove、removeAll,常用的读取操作有contains、get...
分类:
编程语言 时间:
2014-06-28 00:00:26
阅读次数:
449
if (Directory.Exists(path)) { string[] name = Directory.GetFiles(path); foreach (string item in name) { ...
分类:
其他好文 时间:
2014-06-27 18:44:08
阅读次数:
196
一、卸载原来的mysql: 卸载一: 输入: #rpm -qa | grep -i mysql 显示: mysql-libs-5.1.52-1.el6_0.1.i686 卸载方法: yum -y remove mysql-libs-5.1.52-1.el6_0....
分类:
数据库 时间:
2014-06-27 15:54:30
阅读次数:
253
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.
分类:
其他好文 时间:
2014-06-27 12:30:03
阅读次数:
200
Given a linked list, remove the nth node from the end of list and return its head.
分类:
其他好文 时间:
2014-06-27 12:26:10
阅读次数:
322
Given an array and a value, remove all instances of that value in place and return the new length.
分类:
其他好文 时间:
2014-06-27 12:17:58
阅读次数:
156
【JAVA】for,foreach遍历数组时候一些区别...
分类:
编程语言 时间:
2014-06-27 10:40:43
阅读次数:
189