0
votes

I don't understand how to do this, can someone please help.

I need to insert the following keys into an empty AVL tree and show the tree after each insertion. The keys should be taken as strings of characters not as months. For example, Jul < Jun. DEC, JAN, APR, MAR, JUL, AUG, OCT, SEP, FEB, NOV, MAY, JUN

The second tree I need to draw deals with red-black trees. I need to insert the following keys into an empty red-black tree and show the tree after each insertion. The keys should be taken as strings of characters not as months. For example, Jul < Jun. DEC, JAN, APR, MAR, JUL, AUG, OCT, SEP, FEB, NOV, MAY, JUN

Hope someone can help!

1
Well, it is only 12 elements - just insert them one by one to an AVL tree (with pen and paper). There is really no much more then it.amit
I read up about AVL and Red-Black trees but still unsure how to properly do these insertions. I am sorry. Need more thorough help here.Luke Mantrol

1 Answers

0
votes

I love graphviz and dotty from AT&T. It could give you an easy way to quickly render your trees. Add a method to your classes to render dotty output with each step and you'll have it.

There are some nice Java classes that make it easy to work with graphviz here.

Or just use pen and paper.

It sounds like your real issue is not the rendering, it's the behavior of the underlying data structures. Better sort that out first.