Tree Construction and Breadth First Traversal

4

1 votes
Easy
Problem

Print the tree construted in question one in level order (Use the previous code to construct the tree). All the contraints and input format are same as previous question.

Output Format:

Print the tree in level order.

Time Limit: 5
Memory Limit: 256
Source Limit:
Explanation

In the constructed tree level and corresponding nodes are as follows:

Level Nodes
1 1
2 4
3 4, 5
4 6

Hence output is 1 4 4 5 6.

Editor Image

?