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.
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.