<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>肥康 &#187; Programming</title>
	<atom:link href="http://www.moorekang.com/category/programming/feed" rel="self" type="application/rss+xml" />
	<link>http://www.moorekang.com</link>
	<description>憩于理性 行于热情</description>
	<lastBuildDate>Wed, 11 Apr 2012 13:36:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Find duplicated Number and Cycle detection</title>
		<link>http://www.moorekang.com/2012/04/11/find-duplicated-cycle-detection.html</link>
		<comments>http://www.moorekang.com/2012/04/11/find-duplicated-cycle-detection.html#comments</comments>
		<pubDate>Wed, 11 Apr 2012 00:40:35 +0000</pubDate>
		<dc:creator>moorekang</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Algorithms]]></category>

		<guid isPermaLink="false">http://moorekang.com/?p=822</guid>
		<description><![CDATA[<p>一个有趣的问题，据说这个题目耗费了Don Knuth 24小时解决。一起来看看。
# "You are given an array of integers of length n, where each element ranges
#  from 0 to n - 2, inclusive.  Prove that at least one  duplicate element must
#  exist, and give an O(n)-time, O(1)-space algorithm for finding some
#  duplicated element.  You must not modify the array elements during this
#  process."
这有几个重要的约束，O(n)，O(1)的复杂度，不能修改这个数组。可能有多个数重复了，但至少有一个数重复了。
首先第一个证明问题，等价于n个鸽子，n-1个笼子，那么至少有一个笼子里面有2个鸽子，就是鸽笼原理(抽屉原理), 反证法可...........<a href='http://www.moorekang.com/2012/04/11/find-duplicated-cycle-detection.html' rel="nofollow">继续阅读</a></p>随机日志Emacs自虐 (3)《Concrete Abstractions》的一些解答 (0)寒冷的睡不着的早晨的杂感 (0)走出迷宫-路径搜索 (4)魔法书：SICP (2)C 单元测试 (0)给C瓜同学吧 (14)笔试题一 (4)春节杂记 (0)Cflow 分析 (9)]]></description>
			<content:encoded><![CDATA[<p>一个有趣的问题，据说这个题目耗费了Don Knuth 24小时解决。一起来看看。
# "You are given an array of integers of length n, where each element ranges
#  from 0 to n - 2, inclusive.  Prove that at least one  duplicate element must
#  exist, and give an O(n)-time, O(1)-space algorithm for finding some
#  duplicated element.  You must not modify the array elements during this
#  process."
这有几个重要的约束，O(n)，O(1)的复杂度，不能修改这个数组。可能有多个数重复了，但至少有一个数重复了。
首先第一个证明问题，等价于n个鸽子，n-1个笼子，那么至少有一个笼子里面有2个鸽子，就是鸽笼原理(抽屉原理), 反证法可...........<a href='http://www.moorekang.com/2012/04/11/find-duplicated-cycle-detection.html' rel="nofollow">继续阅读</a></p><h2  class="related_post_title">随机日志</h2><ul class="related_post"><li><a href="http://www.moorekang.com/2010/08/02/%e7%ac%94%e8%af%95%e9%a2%98%e4%b8%80.html" title="笔试题一">笔试题一</a> (4)</li><li><a href="http://www.moorekang.com/2010/07/20/union-set-maze.html" title="迷宫生成算法–并查集">迷宫生成算法–并查集</a> (12)</li><li><a href="http://www.moorekang.com/2010/08/20/zheteng.html" title="折腾记录">折腾记录</a> (0)</li><li><a href="http://www.moorekang.com/2011/02/16/chunjie.html" title="春节杂记">春节杂记</a> (0)</li><li><a href="http://www.moorekang.com/2011/12/21/a-emacs-func.html" title="A Emacs func">A Emacs func</a> (0)</li><li><a href="http://www.moorekang.com/2010/08/05/programming-peal.html" title="《编程珠玑》：代码优化">《编程珠玑》：代码优化</a> (2)</li><li><a href="http://www.moorekang.com/2010/08/02/astart-k-shortest-path.html" title="A*算法与K-shortest path问题">A*算法与K-shortest path问题</a> (3)</li><li><a href="http://www.moorekang.com/2011/05/06/valgrind.html" title="valgrind">valgrind</a> (0)</li><li><a href="http://www.moorekang.com/2010/10/06/a-complaint-free-world.html" title="A Complaint Free World">A Complaint Free World</a> (3)</li><li><a href="http://www.moorekang.com/2010/07/13/hello-world.html" title="Hello world！">Hello world！</a> (2)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.moorekang.com/2012/04/11/find-duplicated-cycle-detection.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

