Results 1 to 2 of 2
  1. #1
    H3rtaherta is offline Member
    Join Date
    Nov 2008
    Rep Power

    Default Level order binary tree traversal

    I have inserted random number values into a binary tree and have successfully gotten it to print out in level order correctly but it prints all of them out on one line. I am trying to get it to print out each level on a separate line like
    Level 1: 55
    Level 2: 33 58
    Level 3: .......

    I figure I need to use some kind of loop that will run through and add the node values in a queue and print them out. Then I will need to remove those nodes so that the next level can be added. 2^(levelNumber - 1) I beleive is what I will need to use to figure out how many possible values could be on the row. I just need some ideas to figure out how to correctly add values to a queue print them and remove them and then add the next row's values. I'm using a Vector at the moment to hold values.

  2. #2
    kiranchalla is offline Member
    Join Date
    Apr 2009
    Rep Power

    Default Reg:Level Order binary tree

    Hi Friend,

    If u implement code for level order binary tree implementation Kindly send simple code for the same.

    Thanks & Regards,
    Kiran Challa.

Similar Threads

  1. Binary Search Tree
    By michael_mke in forum New To Java
    Replies: 3
    Last Post: 12-04-2008, 02:03 AM
  2. Binary Search Tree Traversal
    By dch414 in forum New To Java
    Replies: 2
    Last Post: 11-07-2008, 12:01 AM
  3. Can anybody help with cuncurrent binary search tree guys)
    By danylo in forum Threads and Synchronization
    Replies: 1
    Last Post: 04-23-2008, 06:22 PM
  4. Bidirectional Traversal with ListIterator
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-16-2008, 10:37 PM
  5. Binary Tree Implementation in Java
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-16-2008, 10:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts