码迷,mamicode.com
首页 >  
搜索关键字:retain cycle    ( 2217个结果
copy, retain, assign , readonly , readwrite,strong,weak,nonatomic整理
copy:建立一个索引计数为1的对象,然后释放旧对象 对NSString对NSString 它指出,在赋值时使用传入值的一份拷贝。拷贝工作由copy方法执行,此属性只对那些实行了NSCopying协议的对象类型有效。更深入的讨论,请参考“复制”部分。retain:释放旧的对象,将旧对象的值赋予输入对...
分类:其他好文   时间:2014-09-01 23:58:13    阅读次数:619
★ Linked List Cycle II -- LeetCode
证明单链表有环路: 本文所用的算法 可以 形象的比喻就是在操场当中跑步,速度快的会把速度慢的扣圈  可以证明,p2追赶上p1的时候,p1一定还没有走完一遍环路,p2也不会跨越p1多圈才追上  我们可以从p2和p1的位置差距来证明,p2一定会赶上p1但是不会跳过p1的  因为p2每次走2步,而p1走一步,所以他们之间的差距是一步一步的缩小,4,3,2,1,0  到0的时候就重合...
分类:其他好文   时间:2014-09-01 10:48:33    阅读次数:151
Linked List Cycle [leetcode]
#include #include #include using namespace std; struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(NULL) {} }; class Solution { public: bool hasCycle(ListNod...
分类:其他好文   时间:2014-08-31 23:04:12    阅读次数:287
__weak、__strong这样的关键词和weak、strong有哪些区别
ios4 设备上最好就不要使用 ARC。。。strong,weak 用来修饰属性。strong 用来修饰强引用的属性;@property (strong) SomeClass * aObject;对应原来的@property (retain) SomeClass * aObject; 和 @prop...
分类:其他好文   时间:2014-08-31 19:58:11    阅读次数:227
Leetcode 链表 Linked List Cycle II
题意:给定一个单链表,判断该链表中是否存在环,如果存在,返回环开始的节点 思路: 1.定义两个指针,快指针fast每次走两步,慢指针s每次走一次,如果它们在非尾结点处相遇,则说明存在环 2.若存在环,设环的周长为r,相遇时,慢指针走了 slow步,快指针走了 2s步,快指针在环内已经走了 n环, 则有等式 2s = s + nr => s = nr 3.在相遇的时候,另设一个每次走一步的慢指针slow2从链表开头往前走。因为 s = nr,所以两个慢指针会在环的开始点相遇 复杂度:时间O(n) struct...
分类:其他好文   时间:2014-08-30 23:07:40    阅读次数:187
net.sf.json.JSONException: There is a cycle in the hierarchy!
net.sf.json.JSONException: There is a cycle in the hierarchy!怎么解决?过滤掉集合属性便可防止死循环
分类:Web程序   时间:2014-08-30 19:04:09    阅读次数:221
LeetCode Linked List Cycle II 超时问题
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?题目意...
分类:其他好文   时间:2014-08-29 12:44:37    阅读次数:256
完全靠代码生成的ios版hello,world
xcode5 运行在iphone retain 3.5" 模式下(即对应iphone4, iphone4s)需要开启ARC//// main.m// Hello//// Created by lishujun on 14-8-28.// Copyright (c) 2014年 lishuju...
分类:移动开发   时间:2014-08-29 01:14:36    阅读次数:352
LeetCode Linked List Cycle
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?/** * Definition for singly-linked list. *...
分类:其他好文   时间:2014-08-28 19:41:25    阅读次数:224
IOS基础 Day-1手动内存管理
辞职回家打算自学IOS开发,就在借个地方记录一下Day-1 手动内存管理 主要内容:release retain必须配对好,不然会占用内存 慢慢积累导致错误一旦内存占用超过40m 45m时分别发生警告,一旦超过120m 系统将kill你的app 发生闪退主要要防止发生的问题:1.野...
分类:移动开发   时间:2014-08-26 13:29:56    阅读次数:231
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!