Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
{Algo}说到红黑树
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  11 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
pongba  
View profile   Translate to Translated (View Original)
 More options Jul 7 2008, 10:23 am
From: pongba <pon...@gmail.com>
Date: Mon, 7 Jul 2008 22:23:42 +0800
Local: Mon, Jul 7 2008 10:23 am
Subject: {Algo}说到红黑树

就恰好看到chen yufei同学的博客上提到了。我得去看看Sedgewick老大是怎么说的。

via: http://chenyufei.name/blog/2008-07-07/left-leaning-red-black-tree/

CLRS 上对 Red Black Tree (RBT) 的介绍简直是一团乱麻,代码又乱,解释又罗嗦,我完全没有实现它的兴趣……

不得不佩服 Robert Sedgewick 啊,他在 Algorithms in C 里先介绍 2-3-4 Tree,把 RBT 作为 2-3-4
Tree 的一种表示方式来介绍 Red Black Tree,这样就清楚多了。当然,Sedgewick 本来就是 Red Black Tree
的发明者之一 <http://en.wikipedia.org/wiki/Red-black_tree>,他能够讲清楚也就不奇怪了。除了解释清楚以外,Sedgewick
使用递归实现,因此代码很简洁,看起来很舒服。

不过即使如此,Red Black Tree 还是很复杂,所以即使看了 Sedgewick 的代码以后还是没有自己实现的冲动。好在 Sedgewick
已经考虑过这个问题,其结果就是 Left-Leaning Red Black
Tree<http://www.cs.princeton.edu/%7Ers/talks/LLRB/RedBlack.pdf>。(这
份幻灯片做得非常好!Apple 的 Keynote 貌似不错啊。)LLRBT 跟 RBT 的不同之处在于 2-3-4 Tree 的 3 node 在
LLRBT 中只有一种表示方式,因此 LLRBT 减少了 RBT 的插入/删除需要处理的情况数量,从而大大减小了复杂度。RBT 的 Java
迭代实现要用 150 行代码,而递归实现需要 46 行代码,LLRBT 递归则只需要 33
行。删除需要的代码行数也大大减小了,实现难度当然也大大降低了。

我用 Common Lisp 试着实现了 LLRBT,确实很简单。不过我还在想怎样才能迭代实现 LLRBT,找到了 FreeBSD 用头文件实现的
LLRBT<http://www.freebsd.org/cgi/cvsweb.cgi/%7Echeckout%7E/src/lib/libc/std...>
,被彻底雷到了,这宏用的太牛了!
*prince <http://w-a-n.cn/>* on 7 July, 2008 at 7:35 pm #

wikipedia 上的RB-tree也是一坨的,看了都不想看。
最后还是死啃 CLRS 书看懂红黑树的。
不过让我现在描述红黑树,还是没有把握记得。
--
刘未鹏(pongba)|C++的罗浮宫
http://blog.csdn.net/pongba
TopLanguage
http://groups.google.com/group/pongba


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
hayate  
View profile   Translate to Translated (View Original)
 More options Jul 7 2008, 1:16 pm
From: hayate <hayate...@gmail.com>
Date: Tue, 8 Jul 2008 01:16:18 +0800
Local: Mon, Jul 7 2008 1:16 pm
Subject: Re: [TopLanguage] {Algo}说到红黑树

感谢。
rb-tree已经忘了,但是我还记得当年在图书馆默写它的情景 :D

CLRS这部分确实不好看来不是我一个人的感觉,似乎书上一上来就列举rb-tree应该满足的几个条件,但是对于怎么想出这个tree以及怎么得出这些条件却 语焉不详。

2008/7/7 pongba <pon...@gmail.com>:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chen Yufei  
View profile   Translate to Translated (View Original)
 More options Jul 7 2008, 10:41 pm
From: Chen Yufei <cyfde...@gmail.com>
Date: Mon, 7 Jul 2008 19:41:27 -0700 (PDT)
Local: Mon, Jul 7 2008 10:41 pm
Subject: Re: {Algo}说到红黑树
如果没有 Algorithms in C 的话直接看那份幻灯片好了, 书上的内容在幻灯片里面都有的。

FreeBSD 中 LLRBT 实现的作者 Jason Evans 写过一篇文章 “Left-leaning red-black trees
are hard to implement“<http://www.canonware.com/~ttt/2008/04/left-
leaning-red-black-trees-are-hard.html>,不过他写文章时候使用的算法中 4-node 对应 RBT 中向左
倾斜的 3 个节点,可能因此比较难以实现。Sedgewick 在后来的幻灯片中更新了算法,4-node 变为平衡的三个节点。Evans 还比较
了 LLRBT 和其他树实现的性能,在文章的注释中也提到了他将算法改为迭代所采用的办法。


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
pongba  
View profile   Translate to Translated (View Original)
 More options Jul 7 2008, 10:45 pm
From: pongba <pon...@gmail.com>
Date: Tue, 8 Jul 2008 10:45:18 +0800
Local: Mon, Jul 7 2008 10:45 pm
Subject: Re: [TopLanguage] Re: {Algo}说到红黑树

2008/7/8 Chen Yufei <cyfde...@gmail.com>:

> 如果没有 Algorithms in C 的话直接看那份幻灯片好了, 书上的内容在幻灯片里面都有的。

恩,谢谢yufei提醒。
P.S. 昨天下到了Algorithms in Java。应该讲的是一样的,除了语言实现的细节差别之外。

> FreeBSD 中 LLRBT 实现的作者 Jason Evans 写过一篇文章 "Left-leaning red-black trees
> are hard to implement"<http://www.canonware.com/~ttt/2008/04/left-
> leaning-red-black-trees-are-hard.html<http://www.canonware.com/%7Ettt/2008/04/left-leaning-red-black-trees-...>>,不过他写文章时候使用的算法中
> 4-node 对应 RBT 中向左
> 倾斜的 3 个节点,可能因此比较难以实现。Sedgewick 在后来的幻灯片中更新了算法,4-node 变为平衡的三个节点。Evans 还比较
> 了 LLRBT 和其他树实现的性能,在文章的注释中也提到了他将算法改为迭代所采用的办法。

--
刘未鹏(pongba)|C++的罗浮宫
http://blog.csdn.net/pongba
TopLanguage
http://groups.google.com/group/pongba

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
pongba  
View profile   Translate to Translated (View Original)
 More options Jul 8 2008, 10:28 am
From: pongba <pon...@gmail.com>
Date: Tue, 8 Jul 2008 22:28:06 +0800
Local: Tues, Jul 8 2008 10:28 am
Subject: Re: [TopLanguage] Re: {Algo}说到红黑树

基本看完了那个ppt。对于没有看的同学我还要再次大力推荐一下。这恐怕是目前为止地球上对红黑树讲得最透彻的ppt了。

2008/7/8 pongba <pon...@gmail.com>:

> 2008/7/8 Chen Yufei <cyfde...@gmail.com>:

>> 如果没有 Algorithms in C 的话直接看那份幻灯片好了, 书上的内容在幻灯片里面都有的。

> 恩,谢谢yufei提醒。
> P.S. 昨天下到了Algorithms in Java。应该讲的是一样的,除了语言实现的细节差别之外。

--
刘未鹏(pongba)|C++的罗浮宫
http://blog.csdn.net/pongba
TopLanguage
http://groups.google.com/group/pongba

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David  
View profile   Translate to Translated (View Original)
 More options Jul 9 2008, 2:40 am
From: David <chinatangdra...@gmail.com>
Date: Tue, 8 Jul 2008 23:40:28 -0700 (PDT)
Local: Wed, Jul 9 2008 2:40 am
Subject: Re: {Algo}说到红黑树
讲解的确很详细,不过好长。pongba有空不妨写一篇Introduction to RBT。

On 7月8日, 下午10时28分, pongba <pon...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lee MaRS  
View profile   Translate to Translated (View Original)
 More options Jul 9 2008, 3:18 am
From: "Lee MaRS" <leem...@gmail.com>
Date: Wed, 9 Jul 2008 15:18:29 +0800
Local: Wed, Jul 9 2008 3:18 am
Subject: Re: [TopLanguage] Re: {Algo}说到红黑树

看那个PPT就行了。

pongba写出来的只可能会比那个更长。

2008/7/9 David <chinatangdra...@gmail.com>:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
pongba  
View profile   Translate to Translated (View Original)
 More options Jul 9 2008, 3:57 am
From: pongba <pon...@gmail.com>
Date: Wed, 9 Jul 2008 15:57:05 +0800
Local: Wed, Jul 9 2008 3:57 am
Subject: Re: [TopLanguage] Re: {Algo}说到红黑树

2008/7/9 Lee MaRS <leem...@gmail.com>:

> 看那个PPT就行了。

> pongba写出来的只可能会比那个更长。

没错。

况且PPT图文并茂,我还真没见过这么优美的算法讲解。

--
刘未鹏(pongba)|C++的罗浮宫
http://blog.csdn.net/pongba
TopLanguage
http://groups.google.com/group/pongba


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Yufei Chen  
View profile   Translate to Translated (View Original)
 More options Jul 10 2008, 11:35 am
From: "Yufei Chen" <cyfde...@gmail.com>
Date: Thu, 10 Jul 2008 15:35:26 +0000
Local: Thurs, Jul 10 2008 11:35 am
Subject: Re: [TopLanguage] Re: {Algo}说到红黑树
leemars 是复旦的 Arch 教主吧?

2008/7/9 Lee MaRS <leem...@gmail.com>:

--
Best regards,
Chen Yufei

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lee MaRS  
View profile   Translate to Translated (View Original)
 More options Jul 11 2008, 3:36 am
From: "Lee MaRS" <leem...@gmail.com>
Date: Fri, 11 Jul 2008 15:36:58 +0800
Local: Fri, Jul 11 2008 3:36 am
Subject: Re: [TopLanguage] Re: {Algo}说到红黑树

-_-bb 恩...

2008/7/10 Yufei Chen <cyfde...@gmail.com>:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
hongtao wang  
View profile   Translate to Translated (View Original)
 More options Jul 13 2008, 9:22 am
From: "hongtao wang" <wanghongta...@gmail.com>
Date: Sun, 13 Jul 2008 21:22:04 +0800
Local: Sun, Jul 13 2008 9:22 am
Subject: Re: [TopLanguage] {Algo}说到红黑树

正在拜读CLRS,正看到红黑树,幸甚幸甚......

2008/7/7 pongba <pon...@gmail.com>:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google