<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title type="text">博客园_一个程序员的自省_分类_11-数据结构与算法分析</title><id>http://feed.cnblogs.com/blog/u/15645/category/288879/rss</id><updated>2012-05-29T01:15:34Z</updated><generator>feed.cnblogs.com</generator><link rel="alternate" type="text/html" href="http://www.cnblogs.com/anderslly/category/288879.html"/><link rel="self" type="application/atom+xml" href="http://feed.cnblogs.com/blog/u/15645/category/288879/rss"/><entry><id>http://www.cnblogs.com/anderslly/archive/2012/04/19/fibonacci-number.html</id><title type="text">迷人的斐波那契数</title><summary type="text">繁殖力超强的兔子说到斐波那契数，我们自然会想到曾经有一群繁殖力超强的兔子。比萨的商人斐波那契（Fibonacci，12-13世纪，称为比萨的列奥那多）接触到阿拉伯数学后，在其著作《Liber Abaci》中，引入了这个著名的兔子问题。但如果向前追溯下去，则可以追溯到古老的印度数学。斐波那契使用了一个理想化了的兔子生长模型进行研究，并假设：第一个月初有一对刚诞生的兔子两个月之后(第三个月初)它们可以生育每月每对可生育的兔子会诞生下一对新兔子兔子永不死去从第一个月开始，兔子的数目（对）依次是：1，1，2，3，5，8。。。这样就形成了一个序列，记为{Fn}，则该序列存在一个递推关系：F(n)=F(n</summary><published>2012-04-18T16:31:00Z</published><updated>2012-04-18T16:31:00Z</updated><author><name>Anders Cui</name><uri>http://www.cnblogs.com/anderslly/</uri></author><link rel="alternate" href="http://www.cnblogs.com/anderslly/archive/2012/04/19/fibonacci-number.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/anderslly/archive/2012/04/19/fibonacci-number.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/anderslly/archive/2012/04/16/swaping-disks.html</id><title type="text">趣题一则：交替放置的碟子</title><summary type="text">有数量为2n的一排碟子，n黑n白交替放置。现在要把黑碟子都放在右边，白碟子都放在左边，但只允许通过交换相邻碟子的位置来实现。实现这个过程要交换多少次？分析首先把问题转化一下，用1表示黑碟子，0表示白碟子，那么目前的顺序是：1010...1010结果要求1都放在右边，0都放在左边。这个题目看起来很眼熟。看关键字：交换相邻的碟子，排好顺序。嗯，就是经常出现在面试中的冒泡排序了。为便于观察，假设目前有6个碟子：101010。使用冒泡排序，第一次迭代，碟子序列变为：010101，交换3次。在进行第二次迭代之前，观察一下。现在，不仅第一个碟子就位，最后一个也是了，因此第二次迭代只需要对第2到第5个进行排</summary><published>2012-04-16T13:43:00Z</published><updated>2012-04-16T13:43:00Z</updated><author><name>Anders Cui</name><uri>http://www.cnblogs.com/anderslly/</uri></author><link rel="alternate" href="http://www.cnblogs.com/anderslly/archive/2012/04/16/swaping-disks.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/anderslly/archive/2012/04/16/swaping-disks.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/anderslly/archive/2012/04/10/finding-the-door.html</id><title type="text">趣题一则：寻找那扇门</title><summary type="text">现在出现在你面前的是一堵朝两个方向无限延伸的墙。墙上有一扇门，但你并不确定门离你有多远，也不知道门位于哪个方向（左边或是右边）。你只有在走到门面前才能看到它。假设从当前位置到门要走n步（n大小未知），那么怎样走O(n)步就能找到那扇门？分析这道题让人“左右为难”，因为不确定如何才能走到尽快确定方向和位置。首先想到在错误的方向上走得越远，就意味着离正确的位置越远，因此较为保险的方法是，第一步向右走，看看有没有门；第二步——为了防止在错误的方向上渐行渐远——向左走，走两步，这样就可以确定在最初位置的一步范围内有没有门了。接下来，按照类似的方式左右徘徊，依次确定在最初位置的2，3，...，n有没有门</summary><published>2012-04-10T15:51:00Z</published><updated>2012-04-10T15:51:00Z</updated><author><name>Anders Cui</name><uri>http://www.cnblogs.com/anderslly/</uri></author><link rel="alternate" href="http://www.cnblogs.com/anderslly/archive/2012/04/10/finding-the-door.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/anderslly/archive/2012/04/10/finding-the-door.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/anderslly/archive/2011/06/17/hashset-part2.html</id><title type="text">HashSet的实现（下）</title><summary type="text">在HashSet的实现（上）中，简要介绍了散列法（hashing）的内容，并以二次探测法实现了一个简单的HashSet。在本文中，将进一步讨论散列法，尤其是GetHashCode方法的实现，最后给出完整的HashSet实现。</summary><published>2011-06-17T09:19:00Z</published><updated>2011-06-17T09:19:00Z</updated><author><name>Anders Cui</name><uri>http://www.cnblogs.com/anderslly/</uri></author><link rel="alternate" href="http://www.cnblogs.com/anderslly/archive/2011/06/17/hashset-part2.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/anderslly/archive/2011/06/17/hashset-part2.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/anderslly/archive/2011/06/13/hashset-part1.html</id><title type="text">HashSet的实现（上）</title><summary type="text">本文主要讨论了散列法和散列函数的基本概念以及解决散列冲突的两种方法：线性探测法和二次探测法，并以二次探测法简单地实现了HashSet的Hash这一部分。</summary><published>2011-06-12T18:03:00Z</published><updated>2011-06-12T18:03:00Z</updated><author><name>Anders Cui</name><uri>http://www.cnblogs.com/anderslly/</uri></author><link rel="alternate" href="http://www.cnblogs.com/anderslly/archive/2011/06/13/hashset-part1.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/anderslly/archive/2011/06/13/hashset-part1.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/anderslly/archive/2011/03/20/word-search-puzzle.html</id><title type="text">玩儿一下Word Search Puzzle</title><summary type="text">单词搜索迷宫（Word Search Puzzle）问题的输入是一个二维的字符数组和一组单词，目标是找出字符数组网格中的所有单词。本文讨论了它的实现，以及Array.BinarySearch方法的一个值得注意的地方。</summary><published>2011-03-19T16:40:00Z</published><updated>2011-03-19T16:40:00Z</updated><author><name>Anders Cui</name><uri>http://www.cnblogs.com/anderslly/</uri></author><link rel="alternate" href="http://www.cnblogs.com/anderslly/archive/2011/03/20/word-search-puzzle.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/anderslly/archive/2011/03/20/word-search-puzzle.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/anderslly/archive/2011/03/14/integer-expansion.html</id><title type="text">整数的展开</title><summary type="text">简单讨论了整数的b进制展开和康托尔展开。</summary><published>2011-03-13T16:33:00Z</published><updated>2011-03-13T16:33:00Z</updated><author><name>Anders Cui</name><uri>http://www.cnblogs.com/anderslly/</uri></author><link rel="alternate" href="http://www.cnblogs.com/anderslly/archive/2011/03/14/integer-expansion.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/anderslly/archive/2011/03/14/integer-expansion.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/anderslly/archive/2011/03/06/making-changes.html</id><title type="text">找零钱的两种方法</title><summary type="text">采用贪心算法和动态规划解决找零钱的问题。</summary><published>2011-03-06T12:31:00Z</published><updated>2011-03-06T12:31:00Z</updated><author><name>Anders Cui</name><uri>http://www.cnblogs.com/anderslly/</uri></author><link rel="alternate" href="http://www.cnblogs.com/anderslly/archive/2011/03/06/making-changes.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/anderslly/archive/2011/03/06/making-changes.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/anderslly/archive/2008/05/19/factorial-algorithms.html</id><title type="text">关于阶乘的两个常见算法及一个相关面试题</title><summary type="text">本文首先给出了阶乘的数学定义，然后说明了它的两种简单算法，最后提供了一个很有意思的与阶乘相关的面试题的思路。</summary><published>2008-05-19T04:12:00Z</published><updated>2008-05-19T04:12:00Z</updated><author><name>Anders Cui</name><uri>http://www.cnblogs.com/anderslly/</uri></author><link rel="alternate" href="http://www.cnblogs.com/anderslly/archive/2008/05/19/factorial-algorithms.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/anderslly/archive/2008/05/19/factorial-algorithms.html"/><content type="text">本文首先给出了阶乘的数学定义，然后说明了它的两种简单算法，最后提供了一个很有意思的与阶乘相关的面试题的思路。</content></entry></feed>
