I am working on writing red-black tree myself. But when I test the rotation that involves root to be rotated, somewhat it loses reference.
Tree structure:
In red-black tree, when rotate, you need to know who is the parent of particular node.
However, the node only has reference to either right or left child.
I was thinking to ...
Is there any constraint onto compareTo method which orders objects put into the standard java TreeSet (i.e. collection implemented as Red-Black tree)? I have
public class RuleTuple implements Comparable {
...
Yeah no problem, been too long since I implemented a RB tree form me to say comfortably, but since you can follow the rules and sometimes shift either right or left depending on how you coded, you could in theory get different results. However, I remember in my class back in the day, there was only one result, perhaps because we ...
Once you have learned those things, you should have no problem. You might also want to learn how to use google and wikipedia to help you learn #1 and #2 above. As you're proceeding, if you have specific questions, post them here, along with your work so far. Make sure to provide details about what you've done and what difficulty you're ...