摘要: 修改性算法 一、copy copy(myvector.begin(),myvector.end(),l1.begin());在复制前,l1必须是有容量的,否则系统会报错 copy_backward(myvector.begin(),myvector.end(),l1.end());在l1中是从后向前 阅读全文
posted @ 2016-07-02 17:53 ranran1203 阅读(143) 评论(0) 推荐(0)
摘要: 防函数就是在类中包含一个operator()函数,之后这个类就有了类似函数的行为,方便了变量的管理 一、for_each 算法 #include<iostream>#include<vector>#include<algorithm>#include<functional>using namespa 阅读全文
posted @ 2016-07-02 11:59 ranran1203 阅读(482) 评论(0) 推荐(0)
摘要: 可以直接使用的数据结构 stack queue priority_queue 头文件 <stack> <queue> <queue> 声明 stack<int>s1 queue<int>q; #include<functional> #include<vector> priority_queue<i 阅读全文
posted @ 2016-07-01 19:37 ranran1203 阅读(153) 评论(0) 推荐(0)
摘要: bitset了以容纳任意个数个位,并提供各项操作 一、初始化 bitset<16>b1; bitset<16>b2(25); bitset<16>b3(str, 2, 16); 16表示有16位,不足的高位补0 二、容量 b1.size();也就是16 b1.count();1的个数 三、位判断 b 阅读全文
posted @ 2016-07-01 19:14 ranran1203 阅读(312) 评论(0) 推荐(0)
摘要: 关联式容器 set键值和实际数值是一个值,不能包含重复元素,元素自动按从小到大排序,multiset可以包含重复元素的set map是排序的结构体,键值不能重复,multimap允许有重复的键值 set(multiset) map(multimap) 头文件 <set> <map> 定义 #incl 阅读全文
posted @ 2016-07-01 11:32 ranran1203 阅读(257) 评论(0) 推荐(0)
摘要: 说明: 1.list由双向链表实现的,不支持[]和at()函数,有较快的插入和删除函数,同时提供了sort,remove,remove_if ,reverse,merge,splice,unique等独有的函数 2.deque也是动态数组实现的,和vector相比可以push_front,push_ 阅读全文
posted @ 2016-06-30 22:27 ranran1203 阅读(200) 评论(0) 推荐(0)
摘要: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a plan, a canal: Pan 阅读全文
posted @ 2016-06-29 17:08 ranran1203 阅读(239) 评论(0) 推荐(0)
摘要: Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that: For example, Give 阅读全文
posted @ 2016-06-29 16:18 ranran1203 阅读(166) 评论(0) 推荐(0)
摘要: Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) fromstart to end, such that: For example, Given:start  阅读全文
posted @ 2016-06-29 15:13 ranran1203 阅读(254) 评论(0) 推荐(0)
摘要: Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example,Given[100, 4, 200, 1, 3, 2],The longest 阅读全文
posted @ 2016-06-29 11:37 ranran1203 阅读(692) 评论(0) 推荐(0)