- 博客(7)
- 资源 (1)
- 收藏
- 关注
原创 STL set multiset map multimap unordered_set unordered_map example
I decide to write to my blogs in English. When I meet something hard to depict, I'll add some Chinese necessarily. The differences between these containers are :The keys of set and map are
2013-09-30 17:05:59 1184
原创 priority_queue sort 自定义比较终极模板 C++ & JAVA
比较有两种重载,一种是类内部的bool operator#include #include #include #include #include #include using namespace std;class Node{public: int x, y; Node( int a= 0, int b= 0 ):x(a),y(b) {} boo
2013-09-30 16:11:55 1722
转载 strcpy函数 面试题
想起前两天有人发的面试题,其中有strcmp的实现,转这个过来,给大家看看。题目: 已知strcpy函数的原型是: char * strcpy(char * strDest,const char * strSrc); 1.不调用库函数,实现strcpy函数。 2.解释为什么要返回char *。 解说: 1.st
2013-09-26 10:53:03 802
原创 new malloc的区别
这个题出现太频繁了,简单写几点:从是否构造能重载的角度:1. new将调用constructor,而malloc不能;delete将调用destructor,而free不能。2. operator new对应于malloc,但operator new可以重载,可以自定义内存分配策略,甚至不做内存分配,甚至分配到非内存设备上。而malloc无能为力从运算符的角度:3. new/de...
2013-09-26 10:21:48 929
原创 快速排序 递归转非递归
递归程序巧妙地完成了回溯,那么如何将递归程序转换成非递归呢?一般来说,递归的时候一定要分清哪些是可以直接由顶进行到底的(不需要回溯,即手头可以处理好的事件),哪些是需要回溯的(这部分可能根据回溯的顺序来排回溯的优先级,需要标注不同的状态,即待办事件),贴网上某人的博文,觉得总结的非常好。通用法则为:以下是如何把快速排序由递归程序转换为非递归程序:递归的版本为: v...
2013-09-12 18:50:44 1104
原创 LeetCode 132. Palindrome Partitioning II DP 深搜
Palindrome Partitioning IITotal Accepted:2828Total Submissions:16953My SubmissionsGiven a strings, partitionssuch that every substring of the partition is a palindrome.Return the minim...
2013-09-08 17:41:59 874
转载 c/c++数据范围
char -128 ~ +127 (1 Byte)short -32767 ~ + 32768 (2 Bytes)unsigned short 0 ~ 65536 (2 Bytes)int -2147483648 ~ +2147483647 (4 Bytes)uns
2013-09-05 16:58:42 1953
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人