[java] Red Black Tree
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
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.
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.
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
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
Are there *any* trees in the Collections framework? I've never seen any, which I've always found (murder-inducingly) odd.
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
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.)
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.)
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.
java.util.TreeSet
java.util.TreeMap
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement