Re: [patch] rbtrees [was Re: AVL trees vs. Red-Black trees]

Manfred Spraul (manfreds@colorfullife.com)
Mon, 29 Nov 1999 20:18:17 +0100


Andrea Arcangeli wrote:
> + To use rbtrees you'll have to implement your own insert and search cores.
> + This will avoid us to use callbacks and to drop drammatically performances.
> + I know it's not the cleaner way, but in C (not in C++) to get
> + performances and genericity...
> +
> + Some example of insert and search follows here. The search is a plain
> + normal search over an ordered tree. The insert instead must be implemented
> + int two steps: as first thing the code must insert the element in
> + order as a red leaf in the tree, then the support library function
> + rb_insert_color() must be called. Such function will do the
> + not trivial work to rebalance the rbtree if necessary.

What about something similar to the "end_request()" implementation?

ie you #define a name and the (inline) compare function, then you
#include <rbtree.h>. <rbtree.h> creates all functions that you need.

--
	Manfred

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/