Sign in to follow this  
ace84_84

[java] Red Black Tree

Recommended Posts

ace84_84    151
Hi, I am learning about red-black trees, and i am having trouble with the insertion method for a bottom-up tree. I understand and wrote the code for the insertion method of the top-down tre, but i am having a little trouble figuring out how it works, any help??? Thanks

Share this post


Link to post
Share on other sites
owl    376
Do you do this for learning pourposes? std::map uses red black tree.

when you finally understand how it works, I advice you to use std's one which is faster than any other implementation I've found.

Share this post


Link to post
Share on other sites
Son of Cain    480
He's talking about Java, dude ;)

PM me with your email, and I'll send you material about data structures in Java. AFAIK, there's no RBTree in the Collections Framework, but it is quite straightforward to implement your own.

Son Of Cain

Share this post


Link to post
Share on other sites
Son of Cain    480
Quote:
Original post by Kevinator
Are there *any* trees in the Collections framework? I've never seen any, which I've always found (murder-inducingly) odd.


Hehehe, true =D

But take it easy Kev.. Java and its OOP.. makes writting it a breeze ;)

Never searched Apache's Commons Collections. Do they have it?

Son Of Cain

Share this post


Link to post
Share on other sites
Raghar    96
Look into source code of standard library, there is an implementation of a Red -Black tree. IIRC.

Some of the n * log(n) tructure/s is/are implemented this way. Possibly Set, or simillar sorted collection/s. (Try to remmember advantages of this type of tree, and try to guess what data structure would use them well.)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this