Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

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.


>> REGISTER NOW TO START POSTING


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

Results 1 to 5 of 5

Threaded View

  1. #1
    Junior Member
    Join Date
    Feb 2010
    Posts
    10
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default adding items to a binary tree

    I am trying to make a class to build a simple tree. If we have a root as item #1, the next item added (#2) would be its left child. The next item added (#3) would be placed as the right child. The method would sense there are out of options and to go to the far left and use the next depth: Item #4 would be the left child of item #2 and item #5 would be the right child of #2 as well. This would just keep continuing as items are added. What type of steps would it take to do this?
    Last edited by vendetta; February 26th, 2010 at 03:59 PM.


Similar Threads

  1. [SOLVED] generic arguments, binary tree
    By vendetta in forum Collections and Generics
    Replies: 0
    Last Post: February 26th, 2010, 07:40 AM
  2. Problem with binary tree
    By Exoskeletor in forum Object Oriented Programming
    Replies: 2
    Last Post: January 8th, 2010, 01:03 PM
  3. Quick binary tree question.
    By Sinensis in forum Java Theory & Questions
    Replies: 1
    Last Post: November 15th, 2009, 09:28 PM
  4. Binary Search Tree
    By Koren3 in forum What's Wrong With My Code?
    Replies: 9
    Last Post: November 12th, 2009, 09:27 AM
  5. Binary Search Tree implementation
    By Ceasar in forum Java Theory & Questions
    Replies: 3
    Last Post: October 9th, 2009, 12:23 AM