61、警告“addexplicit braces to avoid dangling else”所谓“危险的else”是类似这样的代码:if(a== 10) printf("TEN");else printf("NOT TEN"); a = 100;编译器认为你的else 子句导致语义不清,你到底是什么意思?是无论 a 是否等于10 , if 执行完之后都要将 a 赋值为100,还是只想在 els...
分类:
移动开发 时间:
2014-09-02 12:23:14
阅读次数:
297
A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy ...
分类:
其他好文 时间:
2014-09-02 10:19:24
阅读次数:
194
这个题目是深度复制链表,就是所有节点都是新分配的空间,这一点不难做到,难的是新链表random指针的赋值,想想也没什么好办法,就用map存储两个链表的映射关系,在第一次遍历时只新建节点,建立链表,令新链表中节点的random值等于旧链表的值。第二次遍历再根据map一一映射。 1 class Solu...
分类:
其他好文 时间:
2014-09-02 00:08:03
阅读次数:
259
hash.c 代码分析 Lua 中最重要的一个数据结构及相关操作。 主要看下几个对外的接口。 /*
**?Create?a?new?hash.?Return?the?hash?pointer?or?NULL?on?error.
*/
Hash?*lua_hashcreate?(unsigned?i...
分类:
其他好文 时间:
2014-08-30 17:52:30
阅读次数:
168
原文出自:http://www.bcmeng.com/windows-phone-touch1/请在此输入内容(想死啊,写了一个小时,直接没保存不小心删掉了。那就简单说说吧)Pointer事件有以下事件:PointerCanceledPointerEnteredPointerExitedPointe...
第一章:C/C++语言提供两种不同的编程模式:IPL32和PL64。? IPL32 ● 表示integer/pointer/long三种数据类型是32位(4个字节),在这种模式下,提供32位的地址空间,理论的内存使用限制为4G。? PL64 ● 表示pointer/long两种数据类型是64位(8个...
分类:
其他好文 时间:
2014-08-27 14:31:37
阅读次数:
182
// 创建Scene类class MyScene : public cocos2d::Layer{public: // there's no 'id' in cpp, so we recommend returning the class instance pointer static ...
分类:
其他好文 时间:
2014-08-26 11:07:05
阅读次数:
195
Implement strStr().Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack.class Solution {public: ...
分类:
其他好文 时间:
2014-08-25 13:11:34
阅读次数:
153
LeetCode: Copy List with Random PointerA linked list is given such that each node contains an additional random pointer which could point to any node ...
分类:
其他好文 时间:
2014-08-23 12:34:30
阅读次数:
193
同上题:但是这题需要考虑好对当前节点的left和right的next指针如何设置。 1 /** 2 * Definition for binary tree with next pointer. 3 * struct TreeLinkNode { 4 * int val; 5 * Tre...
分类:
其他好文 时间:
2014-08-22 22:23:59
阅读次数:
324