Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?Solution:快慢指针。 1 /** 2 * Definition for s....
分类:
其他好文 时间:
2014-10-17 15:16:48
阅读次数:
179
在iOS开发过程中,属性的定义往往与retain, assign, copy有关,我想大家都很熟悉了,在此我也不介绍,网上有很多相关文章。现在我们看看iOS5中新的关键字strong, weak, unsafe_unretained. 可以与以前的关键字对应学习strong与retain类似,wea...
分类:
移动开发 时间:
2014-10-17 13:20:00
阅读次数:
183
eg:数据库表对象
@interface Meditation :
NSManagedObject
@property (nonatomic,
retain) NSString * order;//用来排序的属性值,用0、1、2、3...排序
@end
//在这个方法里操作
- (void)tableView:(UITableView *)tableView ...
分类:
编程语言 时间:
2014-10-15 18:22:01
阅读次数:
113
在iOS开发过程中,属性的定义往往与retain, assign, copy有关,我想大家都很熟悉了,在此我也不介绍,网上有很多相关文章。 现在我们看看iOS5中新的关键字strong, weak, unsafe_unretained. 可以与以前的关键字对应学习strong与retain类似,we...
分类:
其他好文 时间:
2014-10-15 15:24:03
阅读次数:
179
题目描述: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 spac...
分类:
其他好文 时间:
2014-10-15 11:10:10
阅读次数:
219
题目描述:Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?解题方案:使用快慢指针,如果有环,快指针肯定会追上慢指针。下面是该题的代码...
分类:
其他好文 时间:
2014-10-15 00:03:19
阅读次数:
183
第一、strong关键字与retain关似,用了它,引用计数自动+1
如果person定义如下:
@interface Person : NSObject
@property(nonatomic,strong)Book *book1;
@end @autoreleasepool {
p1=[[Person alloc] init];
Book *book...
分类:
其他好文 时间:
2014-10-14 19:57:39
阅读次数:
207
Cocos2d-x中所有内存管理方式的基础是引用计数,动态分配一个Ref对象后其引用计数为1,并通过retain和release来增持和减少其引用计数。引用计数本身并不能帮助我们进行内存管理。
为了正确地释放对象的内存,Cocos2d-x使用Objective-C里面的自动回收池的机制来管理对象内存的释放。Autorelease有点类似于一个共享的”智能指针”,该”智能指针”的作用域为一...
分类:
其他好文 时间:
2014-10-13 18:50:09
阅读次数:
251
以形如 _fontValueChangedBlock = ^(){ [self.fontSmallButton addTarget:self action:@selector(btnFontSmallClicked) forControlEvents:UIContr...
分类:
其他好文 时间:
2014-10-13 16:12:29
阅读次数:
170