This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes Tree Data Structure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic

Tree Data Structure

Shine Tom

Joined: Sep 17, 2012
Posts: 19
Can somebody help me with my Tree implementation. I have an array list with values("1.1","1.2","1.3","","","1.4","","","","","1.5","1.6","") and I m trying to create a Tree with this data. Please find below attached my code for the same.

My tree should look like this in the picture attached.

Now I want to print the parent of each node starting from the last one, so starting at "" . and but dont know to to traverse the branch and it's children. Please someone help me.
PS: I am new to java so please correct me if tehre is something wrong.

[Thumbnail for Unbenannt_1.jpg]

Winston Gutkowski

Joined: Mar 17, 2011
Posts: 7501

Shine Tom wrote:Can somebody help me...

This thread appears to be a duplicate of this one.

Please don't double-post.



Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
I agree. Here's the link:
subject: Tree Data Structure
Similar Threads
I am lost , Help Me Please ...JTree
Accessing image files of user entered paths
how to check parent availability in Jtree structure in swing
In your lab05, replace instructor’s Tokenizer class and MyStackQueue package with your own.
JTable In JTree