How i can take level wise input?

how i can take level wise input?

  1. input for level 0
  2. input for level 1
  3. input for level 2 and so on.
    same i want to print tree level wise.

Hey @Vipin_coder
Level order input is taken and tree is build by using the queue, in which firstly u will take a queue of nodes, and then it will have a data which will represent a root node, and then u will accept the left and right child of root node, -1 value means that the node does not have any child.
input : 1 2 3 4 5 -1 6 -1 -1 -1 -1 -1 -1
tree:

              1
          /      \
       2           3
    /     \           \
   4       5           6

print tree level wise:
use Queue data stru
1.Initially add root node inside the queue.
2.Put a loop till the queue is not empty.
3.Remove front node in the queue.( print this node)
put its left and right children in Queue. (if left and right children is not null )