Red black tree wiki confusing
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > Red black tree wiki confusing




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Red black tree wiki confusing  
Bin Chen


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-23-07 06:22 PM

http://en.wikipedia.org/wiki/Red_black_tree

I am reading this, but very confusing about the graph that showed in
case 4. This picture is at the left of case 4. My question is, what is
the node 4 and 5?

It is obvious a leaf and from the definition it is black. The tree
before the node N insertion violates the rule for a red black tree:

5. Every simple path from a node to a descendant leaf contains the
same number of black nodes. (Not counting the leaf node.)

Because:
Path(G->5) = 2
Path(G->1) = 1

So the tree before the node N insertion is not a red black tree!
What's the example for?

Maybe I am wrong but please correct me, thank you!
BTW: I am reading Linux kernel source that contains ref to this
concept, so I post it to the Linux related forum.

abai






[ Post a follow-up to this message ]



    Re: Red black tree wiki confusing  
Armel Asselin


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-23-07 06:22 PM


"Bin Chen" <binary.chen@gmail.com> a ¨¦crit dans le message de news:
1174656577.167043.5460@p15g2000hsd.googlegroups.com...
> http://en.wikipedia.org/wiki/Red_black_tree
>
> I am reading this, but very confusing about the graph that showed in
> case 4. This picture is at the left of case 4. My question is, what is
> the node 4 and 5?
>
> It is obvious a leaf and from the definition it is black. The tree
> before the node N insertion violates the rule for a red black tree:
>
> 5. Every simple path from a node to a descendant leaf contains the
> same number of black nodes. (Not counting the leaf node.)
>
> Because:
> Path(G->5) = 2
> Path(G->1) = 1
>
> So the tree before the node N insertion is not a red black tree!
> What's the example for?
>
> Maybe I am wrong but please correct me, thank you!
> BTW: I am reading Linux kernel source that contains ref to this
> concept, so I post it to the Linux related forum.
I would tell that 4 and 5 are so called "null nodes" (left and right of U
pointing nowhere), then Path (G->U) = 1 is Ok.

Armel







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 07:17 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register