Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?判断一个链表是否存在环,维护快慢指针就可以,如果有环那么快指针一定会追上慢指针,代码...
分类:
其他好文 时间:
2015-11-04 00:32:06
阅读次数:
212
UVa11090 Going in Cycle!!链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=34650【思路】 二分+SPFA。 二分平均值mid,如果有平均值小于mid的情况我们就缩小猜测值否则增大猜测值。如何判定...
分类:
其他好文 时间:
2015-10-25 19:24:12
阅读次数:
272
题目大意:一个n个点,m条无向边的图,求出平均权值最小的回路。题目分析:二分枚举平均值mid,只需判断是否存在平均值小于mid的回路,即判断是否有sum(wi)# include# include# include# include# includeusing namespace std;const...
分类:
其他好文 时间:
2015-10-25 16:13:22
阅读次数:
186
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?思路:维护两个指针,一快一慢,判断两个指针能否相遇。 1 class Solutio...
分类:
其他好文 时间:
2015-10-24 12:54:25
阅读次数:
154
软件开发生命周期SDLC--Software Development Life Cycle.传统的软件开发生命周期有: 瀑布模型:顺序进行,只有完成上一个阶段才能开启下一个阶段,将软件生命周期分为:制定计划、需求分析、软件设计、编写程序、软件测试及运行维护六个基本活动。优点是为项目提供了按阶段划分....
分类:
其他好文 时间:
2015-10-19 15:37:00
阅读次数:
170
本来以为这题很简单,但是看要求,第一不能改变这个数组,第二只能使用O(1)的空间,第三时间复杂度小于O(n^2),就不能使用遍历数组的方式来解决了。 有两种方法,一种是利用Binary Search,一种是利用Floyd的cycle detection算法。 Binary Search M...
分类:
其他好文 时间:
2015-10-19 12:33:52
阅读次数:
224
/**
* ------------------ The Life-Cycle of a Composite Component ------------------
*
* - constructor: Initialization of state. The instance is now retained.
* - componentWillMount
* - render...
分类:
其他好文 时间:
2015-10-09 21:30:08
阅读次数:
193
挺有意思的一道题目。考虑长度为n的数组,重复n次,可以得到n*n的最长上升子序列。同理,也可以得到n*n的最长下降子序列。因此,把t分成prefix(上升子序列) + cycle(one integer repeating) + sufix(下降子序列)。当t 3 #include 4 #in...
分类:
其他好文 时间:
2015-10-09 15:13:28
阅读次数:
237
数据抽取 将几张表中的数据放到一张表中 ????select?s_cycle_date?as?f_date,roam_prov_id,mdn,mdn_city_id?into?tmp_qgj_sqmy?from?mpm00005?where?roam_prov_id<>1?and?mdn_city_id=9
???i...
分类:
其他好文 时间:
2015-10-08 23:19:30
阅读次数:
379
首先交代一下retain cycle ,和 产生retain cycle后我们应该怎么处理。1.retain cycle在block中是极易产生,block就是一段可以灵活使用的代码,你可以把它当做变量传递,赋值,甚至可以把它声明到函数体中。更加灵活的是它可以引用它的承载着(即就是block的运行环...
分类:
其他好文 时间:
2015-09-29 23:27:21
阅读次数:
211