Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: creating a tree in java

  1. #1
    Junior Member
    Join Date
    Sep 2014
    Thanked 0 Times in 0 Posts

    Lightbulb creating a tree in java

    I dont know how to create a tree data structure in java.
    I tried with a class consisting of node field and arraylist child nodes. but it does not satisfy the requirement.
    the requirement is that,
    root: child1,child2,child3
    on traversing it should print all the nodes as given above.
    note: no node should have same elements as child.

    please provide some way to implement this.....

  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Washington, DC
    My Mood
    Thanked 636 Times in 540 Posts

    Default Re: creating a tree in java

    Quote Originally Posted by ilangeeran View Post
    please provide some way to implement this.....
    That really isn't how this works. Please provide an MCVE showing exactly what you've tried and where you're stuck, and we'll go from there.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Super Moderator
    Join Date
    Jun 2013
    So. Maryland, USA
    My Mood
    Thanked 698 Times in 680 Posts

    Default Re: creating a tree in java

    Welcome to the Forum! Please read this topic to learn how to post code correctly and other useful tips for newcomers.

Similar Threads

  1. Creating SWT tree leaves
    By nigele2 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: August 25th, 2014, 04:21 AM
  2. Binary Search Tree inorder tree traversal
    By Maukkv in forum What's Wrong With My Code?
    Replies: 17
    Last Post: January 26th, 2013, 05:28 PM
  3. Data Structures(Binary Search Tree to AVL Tree)ASAP
    By jfAdik in forum Algorithms & Recursion
    Replies: 2
    Last Post: April 5th, 2010, 03:58 AM
  4. Help creating expression tree
    By nellaf in forum Java SE APIs
    Replies: 1
    Last Post: December 3rd, 2009, 08:54 AM
  5. Creating an Expression Tree
    By vluong in forum Collections and Generics
    Replies: 0
    Last Post: November 28th, 2009, 11:41 PM

Tags for this Thread