LWN.net Logo

Trees II: red-black trees

Trees II: red-black trees

Posted Nov 7, 2009 23:55 UTC (Sat) by acolin (subscriber, #61859)
Parent article: Trees II: red-black trees

Thank you for the article!

Note that in my_rb_insert parent must be initialized, otherwise it doesn't work. This can also be seen in example in rbtree.h. So,
> struct rb_node **link = &root->rb_node, *parent;
should be
> struct rb_node **link = &root->rb_node, *parent = NULL;


(Log in to post comments)

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds