<?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; 洗牌</title>
	<atom:link href="http://zhiqiang.org/blog/tag/%e6%b4%97%e7%89%8c/feed" rel="self" type="application/rss+xml" />
	<link>http://zhiqiang.org/blog</link>
	<description>zhiqiang&#039;s personal blog</description>
	<lastBuildDate>Tue, 22 Jun 2010 13:08:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>魔方里的数学</title>
		<link>http://zhiqiang.org/blog/science/mathmatics-in-rubik-cube-and-algorithm.html</link>
		<comments>http://zhiqiang.org/blog/science/mathmatics-in-rubik-cube-and-algorithm.html#comments</comments>
		<pubDate>Wed, 26 Sep 2007 12:26:48 +0000</pubDate>
		<dc:creator>zhiqiang</dc:creator>
				<category><![CDATA[自然科学]]></category>
		<category><![CDATA[Rubik's Cube]]></category>
		<category><![CDATA[图论]]></category>
		<category><![CDATA[洗牌]]></category>
		<category><![CDATA[算法]]></category>
		<category><![CDATA[解法]]></category>
		<category><![CDATA[魔方]]></category>

		<guid isPermaLink="false">http://zhiqiang.org/blog/posts/mathmatics-in-rubik-cube-and-algorithm-2.html</guid>
		<description><![CDATA[今天香港中文大学的Prof. Cai给我们上graph algorithm。第一节课上教我们玩魔方，先给每人发了一个。我喜欢这样的教学方法  。 
魔方的解法，在网上已经有无数了，基本上的思路都是几个定式，玩的时候记住这些定式即可。课上Cai给我们演示了一个他自创的定式，很可惜，我目前为止只学会弄出一面来。
OK，这篇文章的主要目的是讲魔方里的数学，对魔方的群结构研究网上也已...]]></description>
			<content:encoded><![CDATA[<p><a href="http://zhiqiang.org/blog/wp-content/uploads/2fd8c30091e6_11914/d6f5f80ad070.jpg"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="240" alt="魔方" src="http://zhiqiang.org/blog/wp-content/uploads/2fd8c30091e6_11914/_thumb.jpg" width="233" align="right" border="0"/></a>今天香港中文大学的<a title="CAI, Leizhen" href="http://www.cse.cuhk.edu.hk/~lcai/" target="_blank">Prof. Cai</a>给我们上graph algorithm。第一节课上教我们玩魔方，先给每人发了一个。我喜欢这样的教学方法 <img src='http://zhiqiang.org/blog/wp-includes/images/smilies/smile.gif' alt=':)' class='wp-smiley' /> 。 </p>
<p>魔方的解法，在网上已经有<a title="在Google里搜索 魔方 玩法" href="http://www.google.com/search?hl=en&amp;newwindow=1&amp;q=%E9%AD%94%E6%96%B9%E3%80%80%E7%8E%A9%E6%B3%95" target="_blank">无数</a>了，基本上的思路都是几个定式，玩的时候记住这些定式即可。课上Cai给我们演示了一个他自创的定式，很可惜，我目前为止只学会弄出一面来。</p>
<p>OK，这篇文章的主要目的是讲魔方里的数学，对魔方的群结构研究网上也已经有很多，这里不谈了。魔方总共有(8! × 3<sup>8−1</sup>) × (12! × 2<sup>12−1</sup>)/2 = 43252003274489856000=4.3× 10<sup>19</sup>个不同的状态。每个状态看作图上的一个点，则解魔方问题可以视作求一个超大图上的路径问题。这个图是如此之大，使得看上去求最短路这么简单的问题都变得非常困难，事实上，用计算机也不可能直接算。</p>
<p>虽然这个图是如此之大，而且边很少（每个顶点只引出12条边），但这个图的直径却非常小。可以证明，任何一种魔方的状态，都<font color="#ff0000">可以在26步之内复原</font>。（见<a href="http://en.wikipedia.org/wiki/Optimal_solutions_for_Rubik's_Cube" target="_blank">Optimal solutions for Rubik's Cube</a>)</p>
<p>这样的图与以前提到过的<a href="http://zhiqiang.org/blog/posts/the-perfect-number-of-shuffling-7-times.html" target="_blank">洗牌模型</a>里面的图非常相似，结构简单，定点巨多，但混合速度却特别快（从一点会以非常快的速度达到其它点），做算法的很喜欢这种图。</p>
<div><h2>相关文章</h2><ul><li><a href="http://zhiqiang.org/blog/science/computer-science/complexity-of-prime-sieve.html">素数筛法的复杂度</a> <small>Xie Xie给我看了一个链接性能调优--永远超乎想象，里面提到了素数筛法的复杂度，作者用实验发现此筛法是线形的。 所谓素数筛法就是那个求小于n的...</small></li><li><a href="http://zhiqiang.org/blog/science/computer-science/another-perfect-shuffle-algorithm.html">Perfect Shuffle的算法</a> <small>珍爱生命，远离政治。我们继续讨论算法。 2008/04/01补充：此算法有重大缺陷。详情请见留言部分。 一年前，我们讨论过一个算法问题，perfect shuffle，...</small></li><li><a href="http://zhiqiang.org/blog/science/the-perfect-number-of-shuffling-7-times.html">&quot;完美&quot;的洗牌次数 - 7次</a> <small>在大家玩牌的时候，每一局之前都需要重新洗牌——一次洗牌指将牌分为左右两垛然后穿插放牌，但多少次洗牌才是正当的呢？就我多次打牌的观察，...</small></li><li><a href="http://zhiqiang.org/blog/science/computer-science/download-encyclopedia-of-algorithm.html">算法百科全书 - Encyclopedia of Algorithms</a> <small>Xie Xie推荐了一本今年出版的一本新书，Encyclopedia of Algorithms，全书1200页，涵盖各类有名问题的算法，概率算法，近似算法，量子算法等。 翻了一下，...</small></li><li><a href="http://zhiqiang.org/blog/science/computer-science/an-algorithm-face-interviews-question-test.html">一个算法面试题 &#038; 面试题库</a> <small>一个面试题，号称是微软的  输入$$a_1, a_2, ..., a_n, b_1, b_2, ..., b_n$$，如何在O(n)的时间，用O(1)的空间，将这个序列顺序改为$$a_1, b_1, ..., a_n, b_n$$。 刚一...</small></li><li><a href="http://zhiqiang.org/blog/science/computer-science/inverse-square-root-algorithm-analysis.html">求平方根倒数的算法</a> <small>下面这个求$$1/\sqrt{x}$$的函数号称比直接调用sqrt库函数快4倍，来自游戏Quake III的源代码。     float InvSqrt (float x){
    float xhalf = 0.5f*x;
    int i = *(int*)&amp;x...</small></li><li><a href="http://zhiqiang.org/blog/science/a-open-graph-problem.html">一个图论题</a> <small>孙博告诉我的，求证

在任意简单有向图$$G(V,E)$$中，存在一个顶点$$v$$，使得$$|N^2(v)|\geq 2|N(v)|$$，其中$$N(v)=\{u\in V:(v,u)\in E\}$$, $$N^2(v)=\{u\in V:(v,u)\in E \v...</small></li><li><a href="http://zhiqiang.org/blog/science/computer-science/3-color-a-simple-graph.html">一个简单图的三染色算法问题</a> <small>注: 这个问题来自China Theory Week 2008的Open Problems Session。 我们知道在数学里证明一个东西的存在性的时候，有时候只证明了“存在性”，而且在证明过程...</small></li><li><a href="http://zhiqiang.org/blog/science/computer-science/graph-isomorphism-is-polynomial.html">图同构问题属于P？</a> <small>更新：证明的关键一步发现错误，作者更新了论文，结论甚至论文标题都改了（废话），新版本On the graph isomorphism problem。  提交论文到arxiv不需要审阅...</small></li><li><a href="http://zhiqiang.org/blog/science/computer-science/programs-depend-on-date-struct-not-algorithm.html">编程的核心是数据结构，而不是算法</a> <small>Rob Pike, 最伟大的 C 语言大师之一 , 在Notes on C Programming(英文原文)中从另一个稍微不同的角度表述了 Unix 的哲学:   你无法断定程序会在什么地方耗费运...</small></li></ul></div>    <p></p>
    <hr noshade style="margin:0;height:1px" />
    <p>&copy; zhiqiang for <a href="http://zhiqiang.org/blog">阅微堂</a>, 2007. | <a href="http://zhiqiang.org/blog/science/mathmatics-in-rubik-cube-and-algorithm.html">&#38142;&#25509;</a> | <a href="http://zhiqiang.org/blog/science/mathmatics-in-rubik-cube-and-algorithm.html#comments">22 &#26465;&#35780;&#35770;</a></p>]]></content:encoded>
			<wfw:commentRss>http://zhiqiang.org/blog/science/mathmatics-in-rubik-cube-and-algorithm.html/feed</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>&quot;完美&quot;的洗牌次数 - 7次</title>
		<link>http://zhiqiang.org/blog/science/the-perfect-number-of-shuffling-7-times.html</link>
		<comments>http://zhiqiang.org/blog/science/the-perfect-number-of-shuffling-7-times.html#comments</comments>
		<pubDate>Fri, 15 Dec 2006 04:23:51 +0000</pubDate>
		<dc:creator>zhiqiang</dc:creator>
				<category><![CDATA[自然科学]]></category>
		<category><![CDATA[Diaconis]]></category>
		<category><![CDATA[概率]]></category>
		<category><![CDATA[洗牌]]></category>
		<category><![CDATA[理论计算机笔记]]></category>
		<category><![CDATA[随机算法]]></category>
		<category><![CDATA[魔术]]></category>

		<guid isPermaLink="false">http://zhiqiang.org/blog/498.html</guid>
		<description><![CDATA[在大家玩牌的时候，每一局之前都需要重新洗牌——一次洗牌指将牌分为左右两垛然后穿插放牌，但多少次洗牌才是正当的呢？就我多次打牌的观察，多数人都不超过4次。
但就D. Aldous和P. Diaconis在1992的一个结果，要想达到“比较完美”的洗牌效果——洗完牌后牌局基本上随机分布，至少需要5次，要达到“完美”洗牌，则需要7次。但更多次数不会有太多改进。这还是对于一副...]]></description>
			<content:encoded><![CDATA[<p>在大家玩牌的时候，每一局之前都需要重新洗牌——一次洗牌指将牌分为左右两垛然后穿插放牌，但多少次洗牌才是正当的呢？就我多次打牌的观察，多数人都不超过4次。</p>
<p>但就D. Aldous和P. Diaconis<a href="http://www.dartmouth.edu/~chance/course/topics/winning_number.html" target="_blank">在1992的一个结果</a>，要想达到“比较完美”的洗牌效果——洗完牌后牌局基本上随机分布，至少需要5次，要达到“完美”洗牌，则需要7次。但更多次数不会有太多改进。这还是对于一副牌而言的。对于两副牌则需要9次，6副牌需要洗12次。</p>
<p>所用方法是计算图上随机游走达到稳定分布的速度。而这个方法就应用于上面这个结果之后，对于理论计算机的概率算法产生了深远的影响，这也使得P.Diaconis的<a href="http://www.dartmouth.edu/~chance/teaching_aids/books_articles/Mann.pdf" target="_blank">这篇论文</a>超出了它本身看似玩物的领域。</p>
<p>再谈一下<a href="http://www-stat.stanford.edu/~cgates/PERSI/" target="_blank">P. Diaconis</a>，此君14岁离家，去做职业魔术师，没上高中，后来用白天魔术表演挣来的钱晚上念大学课程，最后获得哈佛的博士和斯坦福的教职。另传说中，此人赌技惊人，是赌场不受欢迎之人物。</p>
<div><h2>相关文章</h2><ul><li><a href="http://zhiqiang.org/blog/science/computer-science/boxes-problem-on-static-data-structure-problems.html">摸箱子问题以及在Static data structure problems上的应用</a> <small>以前提到过，理论计算机这门课会邀请一些正在这边访问的教授来讲课，由于是本科生，所以这些教授一般都是讲些有趣的东西，比如之前的overhang 堆...</small></li><li><a href="http://zhiqiang.org/blog/science/googles-crazy-face-questions.html">Google的疯狂面试题</a> <small>有一些是火星题，比如最后一个海盗分金，不太可能还用来作为面试题，估计是被拉过来凑数的。  原文（英文）直接到这里看吧，27floors给出了中文翻...</small></li><li><a href="http://zhiqiang.org/blog/science/how-n-people-divide-a-cake-fairly.html">征集3个人分蛋糕的方法</a> <small> Yao在课程《理论计算机II》的第一节课上提到的一个问题：  三个人如何平分一块蛋糕？ 要求每个人拿到不少于1/3的蛋糕——这里指的是每个人认为自...</small></li><li><a href="http://zhiqiang.org/blog/science/computer-science/tcs-byzantine-failure-the-byzantine-generals-problem.html">TCS: 拜占庭将军问题 (The Byzantine Generals Problem)</a> <small>这个问题在Yao的理论计算机课上整整讨论了2节课。它是一个算法设计问题，也极具趣味性。下面是它的一些介绍和解决方案([1])。

拜占庭帝国就是5...</small></li><li><a href="http://zhiqiang.org/blog/science/three-doors-related-problems.html">三门问题及相关</a> <small>写篇三门问题的终结版。欢迎补充材料。 三门问题，亦称为蒙特霍问题（英文：Monty Hall problem），最初的表述形式：  参赛者会看见三扇关闭了的门，...</small></li><li><a href="http://zhiqiang.org/blog/science/tcs-classroom-notes-the-best-dating-strategy.html">最佳约会策略</a> <small>题外话：最近阅微堂发的都是网友转发的政治方面的文章，不爱看的人会比较痛苦。现在讨论一个轻松一点的话题。其问题，已经被研究了很多年，有...</small></li><li><a href="http://zhiqiang.org/blog/science/test-on-probability.html">概率论感觉测试</a> <small>所有大学生都应该学的两门课程，一是经济学，二是概率论，这两门课分表代表着一种生活中的思维方式。来测试一下你的概率论学得怎么样吧。题目...</small></li><li><a href="http://zhiqiang.org/blog/science/computer-science/tcs-classroom-notes-database-storage-problems.html">TCS课堂笔记：数据库存储问题</a> <small>理论计算机(I)课上讲的一个问题，很有意思。 已经一个n，m和$$\{1,2,\cdots, m\}$$里n个数，设计一种保存这n个元素的表的数据结构形式，使得对$$\{1,2,\cdots...</small></li><li><a href="http://zhiqiang.org/blog/science/game-two-hats.html">帽子游戏二</a> <small>这个题目听说是MSRA的面试题。

在这个游戏的开头，我们设想自己要参加一个电视游戏大奖赛。规则呢，是这样。我们有 n 个人，作为一个小组来参...</small></li><li><a href="http://zhiqiang.org/blog/resource/magics-in-2009-spring-festival-gala.html">2009年的春节晚会魔术</a> <small>表演者刘谦 皮筋魔术，这个不需要啥道具，现实中就可以玩来泡小mm。视频演示：  硬币进玻璃杯应该就是从两个杯子的空隙里把硬币弹入到杯子里。 ...</small></li></ul></div>    <p></p>
    <hr noshade style="margin:0;height:1px" />
    <p>&copy; zhiqiang for <a href="http://zhiqiang.org/blog">阅微堂</a>, 2006. | <a href="http://zhiqiang.org/blog/science/the-perfect-number-of-shuffling-7-times.html">&#38142;&#25509;</a> | <a href="http://zhiqiang.org/blog/science/the-perfect-number-of-shuffling-7-times.html#comments">6 &#26465;&#35780;&#35770;</a></p>]]></content:encoded>
			<wfw:commentRss>http://zhiqiang.org/blog/science/the-perfect-number-of-shuffling-7-times.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
