
c/c++
文章平均质量分 84
gene00sun
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
for_each and functional object(很好的文章)
Abstract之前在(原創) 如何使用for_each() algorithm? (C/C++) (STL) 曾經討論過for_each(),不過當時功力尚淺,只談到了皮毛而已,這次看了effective STL的item 41、43後,對for_each()又有了更深入的了解,因此做了本篇心得報告。Motivation看到了eXile的C++中实现 foreach使用了巨集转载 2014-10-31 03:16:09 · 385 阅读 · 0 评论 -
leetcode Majority Element
Given an array of size n, find the majority element. The majority element is the element that appears more than⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element原创 2015-03-04 21:18:14 · 374 阅读 · 0 评论 -
leetcode Excel Sheet Column Number
Excel Sheet Column NumberRelated to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1原创 2015-03-04 20:24:38 · 491 阅读 · 0 评论 -
leetcode Factorial Trailing Zeroes
Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.编程之美上有算法,简单讲就是把n!分解因子为...2^x 3^y 5^z .....但是对0有贡献的只有2和5,并且2的个数原创 2015-03-04 19:57:51 · 379 阅读 · 0 评论 -
leetcode Excel Sheet Column Title
Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB 关键在于n是先原创 2015-03-06 13:01:08 · 370 阅读 · 0 评论 -
C语言抽象数据类型及不透明指针
http://blog.youkuaiyun.com/clannad_wawa/article/details/40922097一、前言封装(Encapsulation)是一个在现代程序设计里无处不在的手段。对过程的封装,我们称其为函数(Function),对某个对象的属性及行为的封装我们称其为类(Class)。很多高级程序设计语言都提供了足够的特性来支持封装。封装的目的是转载 2015-04-08 12:30:54 · 1104 阅读 · 0 评论 -
STL中mem_fun和mem_fun_ref的用法
http://blog.youkuaiyun.com/starlee/article/details/1400811怎么对容器中的所有对象都进行同一个操作?我们可能首先想到的是用循环来实现。 比如有如下的一个类:class ClxECS{public: int DoSomething() { // 这里以输出一句话转载 2016-03-01 14:18:40 · 452 阅读 · 0 评论 -
unordered学习(c++11)
http://blog.youkuaiyun.com/mmzsyx/article/details/8240071散列容器(hash container): 通常比二叉树的存储方式可以提供更高的访问效率.#include #include using namespace boost;散列集合简介: unordered库提供两个散列集合类unordered_set和u转载 2016-02-16 08:48:09 · 502 阅读 · 0 评论 -
vector转换成数组
std::vector,内部存储的所有元素,都是占用一片连续的内存空间。因此,比较好的做法就是直接取第一个元素的地址,得到了首地址,之后的做法与数组也是大同小异了。举例说明。假设函数Func需要以数组的方式传递,函数原型如下:void Func(double* pDataAddress, size_t nDataCount);那么,如果使用数组,调用的方法如下:do转载 2016-02-22 10:34:57 · 13613 阅读 · 0 评论