自动引用计数(Automatic Reference Counting),是一个编译期间工作的能够帮你管理内存的技术。 ARC在编译期间为每个Objective-C指针变量添加合适的retain, release, autorelease等函数,保存每个变量的生存周期控制在合理的范围内,以期实现代码...
分类:
其他好文 时间:
2015-03-28 21:39:26
阅读次数:
231
//方式1.直接在View上show?? HUD?=?[[MBProgressHUD?showHUDAddedTo:self.view?animated:YES]?retain];?? HUD.delegate?=?self;?? ?? //常用的设置?? //小矩形的背景色?? HUD.color?=?[UICo...
分类:
其他好文 时间:
2015-03-28 13:07:23
阅读次数:
129
Description如果某个无向连通图的任意一条边至多只出现在一条简单回路(simple cycle)里,我们就称这张图为仙人图(cactus)。所谓简单回路就是指在图上不重复经过任何一个顶点的回路。举例来说,上面的第一个例子是一张仙人图,而第二个不是——注意到它有三条简单回路:(4,3,2,1,...
分类:
其他好文 时间:
2015-03-28 12:53:06
阅读次数:
144
cocos2d-x中的内存管理机制 Object *obj = new Object(); obj->autorelease();//自动释放资源 // { // //在这段中使用obj // obj->retain();//保留对象 // obj->release();//手动释放资源 // .....
分类:
其他好文 时间:
2015-03-28 08:44:53
阅读次数:
153
DescriptionCycle shifting refers to following operation on the sting. Moving first letter to the end and keeping rest part of the string. For example,...
分类:
其他好文 时间:
2015-03-21 21:08:29
阅读次数:
713
问题描述Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space...
分类:
其他好文 时间:
2015-03-21 15:32:34
阅读次数:
155
Graph’s Cycle Component
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others)
Total Submission(s): 2112 Accepted Submission(s): 775
Problem Description
In gra...
分类:
其他好文 时间:
2015-03-21 12:42:43
阅读次数:
143
1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x), ne...
分类:
其他好文 时间:
2015-03-20 08:03:53
阅读次数:
125
给出一个链表,假如这个链表有环,返回这个环的起点,否则返回null做法:用两个指针,p1 表示慢指针,p2表示快指针,快指针每次走2步,慢指针每次走一步,如果没环,必然是以p2->next->next = null或者p1 = null结束,如果有环p1与p2必然会相遇,当两指针相遇时使p1 指向h...
分类:
其他好文 时间:
2015-03-19 23:23:55
阅读次数:
97
如果一个对象的生命周期显而易见,很容易就知道什么时候该new一个对象,什么时候不再需要使用,这种情况下,直接用手动的retain和release来判定其生死足矣。但是有些时候,想知道某个对象在什么时候不再使用并不那么容易。如果下面的代码,看上去非常简单:Sample.h类接口部分#import @i...
分类:
其他好文 时间:
2015-03-19 18:06:42
阅读次数:
143