- 博客(11)
- 收藏
- 关注
转载 c/c++的|、||、&、&&、异或、~、!运算
位运算 位运算的运算分量只能是整型或字符型数据,位运算把运算对象看作是由二进位组成的位串信息,按位完成指定的运算,得到位串信息的结果。位运算符有: &(按位与)、|(按位或)、^(按位异或)、~ (按位取反)。 其中,按位取反运算符是单目运算符,其余均为双目运算符。 位运算符的优先级从高到低,依次为~、&、^、|, 其中
2016-09-09 11:32:49
505
转载 C++中map、hash_map、unordered_map、unordered_set通俗辨析
http://www.360doc.com/content/16/0316/17/19175681_542733689.shtml
2016-08-06 17:30:42
293
转载 leetcode-刷题经验
以下内容来自本人在 一亩三分地 论坛上开帖得到的回复。既然慢就多思考优化呀。。。通常有以下思路 (临时总结,仅供参考):*1. 找性能瓶颈。比如排序是nlogn最耗时,有没有办法不排序直接得到答案?比如two sum,不排序,直接上hashmap2. 优化代码。有挺多种情况(1) 有没有多余的操作?比如不必要的copy(2) 递归能不能换迭代?在递归的overhead比较高的时
2016-08-06 08:16:56
1365
原创 c++中set特性和如果索引类set容器的元素
class Solution {public: vector intersection(vector& nums1, vector& nums2) { sets1,s2; int n1=nums1.size(),n2=nums2.size(); for(int i=0;i for(int i=0;i
2016-08-05 17:44:58
2605
原创 20160804-CPP-map
map def: Constructs a list of a specific size or with elements of a specific value or with a specific allocator or as a copy of some other map.1、map之间可以用 = 或者 ! = 来比较两个map之间是否相等, multimap也可以用。ma
2016-08-04 15:41:51
325
原创 20160801-leetcode-vector
http://www.cplusplus.com/forum/vector::push_back() 从begin()开始push进去,最后一个push进去的是end()
2016-08-01 16:01:44
236
原创 20160724-leetcode-array
1 不要忘记考虑极限值情况,如输入值为 0 2 if条件语句中,不要把==写成=3 vector容器扩展还是需要用push_back语句https://github.com/XingyuGuUCSD/leetcode/blob/master/118.%20Pascal's%20Triangle
2016-07-24 23:15:45
196
原创 20160724-leetcode-array
1 不要忘记考虑极限值情况,如输入值为 0 2 if条件语句中,不要把==写成=3 vector容器扩展还是需要用push_back语句https://github.com/XingyuGuUCSD/leetcode/blob/master/118.%20Pascal's%20Triangle
2016-07-24 23:14:17
192
原创 向量空间和指针
c++标准库中最有用的容器是向量 vectorpush_back() 扩展向量 size() 获得向量中元素的个数 存在其他标准库容器,例如映射c++中一种可以保存地址的数据类型称为 指针 形式: double* 为指向double类型的指针eg. char ch; int ii; char* pc = & ch; int* pi = & ii; *pi =
2016-07-17 01:29:26
523
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人